Skip to content

Read time out with multiple simultaneous xmlrpc calls #815

Open
@mikeyg123

Description

@mikeyg123

I have code that tries to stop and start a large number of independent processes in parallel and wait for the action to finish before returning. e.g. using the blocking class like supervisor.stopProcess("foo", true); I'm using a single org.apache.xmlrpc.client.XmlRpcClient instance with parallel calls to execute().

If I have more than 3 or 4 calls in progress I get "read timed out" exceptions from the underlying socket.
If I retry a stopProcess call after a read timed out but before stopwait has expired I get an exception with "NOT_RUNNING" - which is incorrect as the process state is still reported as STOPPING.

I can or use a semaphore to throttle the number of connections but this isn't foolproof as other processes may use up the connections. It would be useful to increase the limit significantly.

I've currently implemented a retry + polling for state changes mechanism - but this isn't ideal. Something else could starts or stop the process at the wrong time and I'll miss the state I'm looking for and fail the whole operation. It's also difficult to set a maximum timeout as our processes have widely different stopwait and startsecs settings.

Is it possible to:

  • increase the number of simultaneous xmlrpc calls
  • Make it so that if stopProcess(name, wait=True) is called while the process is STOPPING then the method blocks until the process reaches the STOPPED state instead of throwing NOT_RUNNING
  • Same for startProcess(name, wait=True) while a process is STARTING should block until the process reaches the started state

Thank you

Exception:
org.apache.xmlrpc.XmlRpcException: Failed to create input stream: Read timed out
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:99)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:152)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)
...
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:92)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:152)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions