Services stop working after one minute

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Services stop working after one minute

Kusig
Hi, I'm working with Cling 2.0.1, created a control point which connects to Media Server Library (foobar2000) and sends a track to the foobar2000 Renderer. So far everything is working very well, all Actions work as expected.

Just after exact one minute after registration or after executed one command (eg. stop or AVTransportUri) the services do not react anymore and they do call the failure event handlers with the following error message when trying to execute a new action.

Error: Current state of service prevents invoking that action. Connection error or no response received.

After I got from MediaLibrary and Renderer both this same error, it starts working again for exactly one minute to fail again afterwards.

Any idea where to search for?  I guess it might be a missing alive or something like that. Thanks for any hint about this.
Reply | Threaded
Open this post in threaded view
|

Re: Services stop working after one minute

Kusig
After many hours debugging within Cling the only thing I found is that the blocking is exactly as long as the parameter given to ClingExecutor:

        public ClingExecutor(ThreadFactory threadFactory, RejectedExecutionHandler rejectedHandler) {
            // This is the same as Executors.newCachedThreadPool
            super(0,
                  Integer.MAX_VALUE,
                  60L,
                  TimeUnit.SECONDS,
                  new SynchronousQueue<Runnable>(),
                  threadFactory,
                  rejectedHandler
            );


There are 60 seconds hardcoded. If I change this to another value the working time changes as well (If I send another command within this timeout it works).
Didn't found a problem in the Upnp reply with Wireshark, this seems to be ok. It works anyhow without problems if I wait less than the hardcoded keepAliveTime above so I don't think there is a problem with that.

Any further hints how to search further are still welcome ...
Reply | Threaded
Open this post in threaded view
|

Re: Services stop working after one minute

Kusig
This post was updated on .
In reply to this post by Kusig
Some more facts about this. It seems to come down to the following exception thrown within AbstractStreamClient.sendRequest(..) method.

It catches a    
    java.net.SocketException: Software caused connection abort: socket write error
in the ExecutionException catch block.  

Then after another minute the exception

    java.util.concurrent.ExecutionException: org.apache.http.NoHttpResponseException: 192.168.200.2:1827 failed to respond  

is catched at the same place. Looks as it hangs there waiting for an answer somehow.

This only happens if I invoke a command more than 60 seconds after the last one. If invoked before, it works without problems.

Additional info, my application runs within Tomcat7, probably there is a relation?

What I don't understand actually is why in the ExecutionException catch handler the abort(request) isn't called as in the other catch blocks. This might be reason that there comes after some time a second exception once the request times out ... Just a guess.
Reply | Threaded
Open this post in threaded view
|

Re: Services stop working after one minute

Kusig
In reply to this post by Kusig
Finally added on application level a simple retry mechanism to overcome the connection problems as a workaround ....