google-code-export / red5

Automatically exported from code.google.com/p/red5
0 stars 0 forks source link

Impossible to disconnect RTMPClient after remote method invocation #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have an RTMPClient instance that I use for invoking remote commands
on a Wowza Media Server. The invocation and reply from the server
works fine. However, once I call RTMPClient.invoke(...), it is
impossible to make the client properly shut down. If I skip calling
invoke(...) I can easily disconnect and all resources are made
available. That is (the code below is sample code showing the order of
which the methods are invoked, the real code is of course handling the
server response in an asynch. manner, by calling .invoke()
and .disconnect() only after a response from the server has been
retrieved):

Does not work:

What steps will reproduce the problem?

RTMPClient myClient = new RTMPClient();
myClient.connect(..., callback_method); // Ok, callback is invoked
once based on server response
myClient.invoke("remoteMethod", parameters,...); // Ok, remote method
is invoked
myClient.disconnect(); // NOT OK, waits forever. Seems that the
socketConnector.dispose() in RTMPClient never finishes (blocking
forever). -> NIOSocketConnector thread and NIOProcessor thread never
stops running. Also, creating new instances of RTMPClient also creates
4 new instances of org.red5.io.amf.Output.stringCache/getterCache/
fieldCache/serializeCache. In total 6 new threads are created each time the 
instance is reused (or another instance is created).

Further, it is possible to reuse the client to reconnect and invoke further 
methods on the server until a certain point when the connect() just hangs 
because of blocking threads.

What is the expected output? What do you see instead?
RTMPClient myClient = new RTMPClient();
myClient.connect(..., callback_method); // Ok, callback is invoked
once based on server response
myClient.invoke("remoteMethod", parameters,...); // Ok, remote method
is invoked
myClient.disconnect(); // Ok, threads stop running, and the client instance can 
be used for new connections.

What version of the product are you using? On what operating system?
0.9.0 Final,RC1,RC2, WindowsXP
0.9.1 Final, Windows XP

Please provide any additional information below.
Has not been tested with 1.0 RC1
Setting timeouts on the connection also seems to be ignored.

Original issue reported on code.google.com by Teee...@gmail.com on 19 Feb 2011 at 8:39

GoogleCodeExporter commented 9 years ago

Original comment by mondain on 20 Oct 2011 at 5:31

GoogleCodeExporter commented 9 years ago
Test with r4327 or later.

Original comment by mondain on 30 Apr 2012 at 10:42