zmmailbox postRestU...
 
Notifications
Clear all

zmmailbox postRestURL doesn't work

6 Posts
3 Users
11 Reactions
7,579 Views
dominix
(@dominix)
Joined: 12 years ago
Posts: 135
Topic starter  

Hi everyone here,

needless to say, the file is valid, the user exist, there is room on the server. however I am not able to restore any file this way (I am migrating a server)

this is Release 9.0.0.ZEXTRAS.20220713.UBUNTU20.64 UBUNTU20_64 FOSS edition.

any tips, direction or indications is welcome.

zmmailbox -z -v -m specificuser postRestURL '//?fmt=tgz&resolve=skip' ./my-archive-file.tar.gz
ERROR: zclient.IO_ERROR (Read timed out) (cause: java.net.SocketTimeoutException Read timed out)
com.zimbra.common.zclient.ZClientException: Read timed out
ExceptionId:main:1662144146623:e82dba18bd4b0af4
Code:zclient.IO_ERROR
at com.zimbra.common.zclient.ZClientException.IO_ERROR(ZClientException.java:49)
at com.zimbra.client.ZMailbox.postRESTResource(ZMailbox.java:3587)
at com.zimbra.cs.zclient.ZMailboxUtil.doPostRestURL(ZMailboxUtil.java:3036)
at com.zimbra.cs.zclient.ZMailboxUtil.execute(ZMailboxUtil.java:1313)
at com.zimbra.cs.zclient.ZMailboxUtil.main(ZMailboxUtil.java:2917)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1455)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1059)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at com.zimbra.common.httpclient.HttpClientUtil.executeMethod(HttpClientUtil.java:73)
at com.zimbra.common.httpclient.HttpClientUtil.executeMethod(HttpClientUtil.java:50)
at com.zimbra.client.ZMailbox.postRESTResource(ZMailbox.java:3579)
... 3 more

   
Quote
mgarbo
(@mgarbo)
Joined: 10 years ago
Posts: 61
 

Hi @dominix,

did you try to add -t ( timeout ) optionΒ  ?

zmmailbox --help

zmmailbox [args] [cmd] [cmd-args ...]

  -h/--help                                display usage
  -f/--file                                use file as input stream
  -u/--url      http[s]://{host}[:{port}]  server hostname and optional port. must use admin port with -z/-a
  -a/--admin    {name}                     admin account name to auth as
  -z/--zadmin                              use zimbra admin name/password from localconfig for admin/password
  -y/--authtoken {authtoken}               use auth token string (has to be in JSON format) from command line
  -Y/--authtokenfile {authtoken file}      read auth token (has to be in JSON format) from a file
  -m/--mailbox  {name}                     mailbox to open
     --auth     {name}                     account name to auth as; defaults to -m unless -A is used
  -A/--admin-priv                          execute requests with admin privileges
                                           requires -z or -a, and -m
  -p/--password {pass}                     auth password
  -P/--passfile {file}                     read password from file
  -t/--timeout                             timeout (in seconds)
  -v/--verbose                             verbose mode (dumps full exception stack trace)
  -d/--debug                               debug mode (dumps SOAP messages)

As reported from this commit :

https://github.com/Zimbra/zm-mailbox/commit/61d2511d216e6896a49b859a2c37b1ae666bc515

Added -t/--timeout option to zmmailbox CLI, for timeout in seconds.  0 means infinite, and default is to use httpclient_connmgr_so_timeout from localconfig. (The default for that is 60000ms, or 60 seconds.)

   
ReplyQuote
dominix
(@dominix)
Joined: 12 years ago
Posts: 135
Topic starter  

it works with -t if I use some small files. wheb using big files it looks I have some more errors.

thanks for the tips.


   
ReplyQuote
mgarbo
(@mgarbo)
Joined: 10 years ago
Posts: 61
 
Posted by: @dominix

it works with -t if I use some small files. wheb using big files it looks I have some more errors.

thanks for the tips.

Probably it's a problem related by proxy timeout, if you don't specify the url zmmailbox will use the default zimbra port :

zmmailbox -z postRestUrl
usage:

  postRestURL(pru)             [opts] {relative-path} {file-name}
    -c/--contentType        content-type
    -u/--url                url to connect to
    -i/--ignore                  ignore and continue on error during ics import
    --preserveAlarms             preserve existing calendar alarms during ics import (default is to use alarms in ics file)

A correct way to do a postRestUrl ( as getRestUrl ) is to bypass completely the proxy :

zmmailbox -t 0 -u  https://usermailbox:admin_port  -z  -m user@domain postRestURL -u  https://usermailbox:mailbox_port   '//?fmt=tgz&resolve=skip' ./my-archive-file.tar.gz


usermailbox = where is the user ( if you have multi mailbox you need to specify the correct one of the user )
admin_port = usually is 7071 but if you enabled the proxy for admin web interface you need to specify the NON proxied port ( usually 9071 )
mailbox_port = usually is 443 or 80, if you enabled the the proxy for user web interface you need to specify the NON proxied port ( usually 8080 or 8443 )

Command to fectch port info per mailbox  :
zmprov gs `zmhostname` zimbraMailPort zimbraMailSSLPort zimbraAdminPort

   
dominix, Arman Khosravi, dominix and 1 people reacted
ReplyQuote
mgarbo
(@mgarbo)
Joined: 10 years ago
Posts: 61
 

@dominix

I found the correct parameters that can help you to solve the problem :

zmlocalconfig socket_so_timeout
socket_so_timeout = 30000

Change this with an high value e.g.

zmlocalconfig -e socket_so_timeout=3000000
zmlocalconfig --reload

Finally retry.

At end of import please restore the original value using this:

zmlocalconfig -u socket_so_timeout
zmlocalconfig --reload

Β 

p.s. i found this solution using -v on zmmailbox import command that give to me the following stack trace :

com.zimbra.common.zclient.ZClientException.IO_ERROR(ZClientException.java:49)
 at com.zimbra.client.ZMailbox.postRESTResource(ZMailbox.java:3587)
 at com.zimbra.cs.zclient.ZMailboxUtil.doPostRestURL(ZMailboxUtil.java:3036)
 at com.zimbra.cs.zclient.ZMailboxUtil.execute(ZMailboxUtil.java:1313)
 at com.zimbra.cs.zclient.ZMailboxUtil.main(ZMailboxUtil.java:2917)
Caused by: java.net.SocketTimeoutException: Read timed out
 at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
This post was modified 1 year ago by Arman Khosravi

   
Arman Khosravi, dominix, Arman Khosravi and 1 people reacted
ReplyQuote
(@francoisotho)
Joined: 2 years ago
Posts: 1
 

@MGARBO

Thank a lot ! πŸ™‚

Since the time i had this problem ...

I try your solution on 2 servers and that solves the problem.

I specify that "zmlocalconfig --reload" is not necessary.

Sequence :

zmlocalconfig -e socket_so_timeout=3000000
zmmailbox -z -m ACCOUNT postRestURL "?fmt=tgz&resolve=skip" FIC.TGZ
zmlocalconfig -u socket_so_timeout

is sufficient and works like a charm.


   
ReplyQuote