Hi,
Currently I am srtuggling with deploying an app with RTMPS endpoints
enabled. What happens is that a socket created by the Legacy RTMP
Server seems to be corrupted and an invoking the getRemoteAddress
method causes NPE. This is a stacktrace I am getting:
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R
java.lang.NullPointerException
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R at
java.lang.Throwable.<init>(Throwable.java)
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R at
java.lang.Throwable.<init>(Throwable.java)
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R at
java.lang.NullPointerException.<init>(NullPointerException.java:61)
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R at
flex.messaging.endpoints.rtmp.AbstractRTMPServer.screenRemoteAddress(AbstractRTMPServer.java:1304)
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R at
flex.messaging.endpoints.rtmp.BaseLegacyRTMPServer.run(BaseLegacyRTMPServer.java:134)
[25/03/08 19:02:33:569 CET] 5010501 SystemErr R at
java.lang.Thread.run(Thread.java:806)
We've managed to spot the line of code that is causing the problem
(decompiled BaseLegacyRTMPServer):
public void run()
{
getServerEndpoint().getMessageBroker().initThreadLocals();
try
{
acceptSocket = buildAcceptSocket();
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (Log.isInfo())
Log.getLogger("Endpoint.RTMP").info(getServerName() + "
listening
on port:" + getServerPort());
IOException ioe = null;
while (isRunning())
{
Socket clientSocket = null;
try
{
clientSocket = acceptSocket.accept(); //----->
socket creation
}
catch (IOException ioex)
{
if (isRunning())
{
stopServer();
RTMPException re = new RTMPException();
re.setMessage(10851, new Object[] {
ioex.getMessage()});
re.setRootCause(ioex);
throw re;
}
break; /* Loop/switch isn't completed */
}
if
(screenRemoteAddress(clientSocket.getRemoteSocketAddress()))
//------> NPE is thrown here!!!!!!
{
if (Log.isInfo())
Log.getLogger("Endpoint.RTMP").info(
getServerName()
+ " blocked access from
client with remote address: "
+
clientSocket.getRemoteSocketAddress());
try
{
clientSocket.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
continue; /* Loop/switch isn't completed */
}
try
{
LegacyRTMPConnection connection = new
LegacyRTMPConnection(this,
clientSocket, getClientTimeout());
//new connection is created here
connection.setDebug(isDebug);
connections.put(connection.getId(), connection);
scheduleTimeout(connection);
executeThread(connection);
}
catch (SocketException se)
{
if (Log.isInfo())
Log.getLogger("Endpoint.RTMP").info(
getServerName() + " socket for
accepting client connections
closed.");
}
// Misplaced declaration of an exception variable
catch (IOException ioex)
{
if (Log.isDebug())
Log.getLogger("Endpoint.RTMP").debug(
getServerName() + ": Client
closed connection before it was
fully established.");
}
}
if (Log.isError())
Log.getLogger("Endpoint.RTMP").error(getServerName() +
" failed to
start up.", ioe);
RTMPException re = new RTMPException();
re.setMessage(10850, new Object[] { ioe.getMessage()});
re.setRootCause(ioe);
throw re;
}
Would anyone have any idea why it might be happening? Is it an
environmental issue or config related one? Any help is very appreciated!
Cheers,
Bartek