powered by Jive Software

Strange behaviour

Hi,

I’'m trying to load server with a large number of connections. I have developed a test-program with the smack library and I have create 5 test user account daniele0,daniele1,…daniele5. My test program simply use this 5 account changing resource name to automatically login into the server.

The behaviour is that sometimes I riceved this error message into the server:

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:5 01)

at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:343)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:720)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImp l.java:1025)

at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:10 38)

The strange things that Its happens also with only 10 concurrent connections.

This is my test program:

import java.util.*;

import org.jivesoftware.smack.*;

import org.jivesoftware.smack.packet.*;

import org.jivesoftware.smackx.packet.*;

/******************************************************************************

*****************************************************************************/

/******************************************************************************

  • @author daniele

*****************************************************************************/

public class JabberConnection

{

static class SingleConnection extends Thread

{

int number;

String server;

public SingleConnection( String server, int n )

{

number = n;

this.server = server;

}

public void run()

{

ConnectionConfiguration config = new ConnectionConfiguration( server, 5222 );

try

{

XMPPConnection con = new XMPPConnection( config );

con.login(“daniele” + ( number % 5 ), “password”, “res” + number );

}

catch( Exception e )

{

e.printStackTrace();

}

}

}

/******************************************************************************

  • @param args

*****************************************************************************/

public static void main(String[] args) throws Exception

{

int maxConnections = 10;

XMPPConnection.DEBUG_ENABLED = false;

String server = “localhost”;

if ( args.length > 0 )

{

server = args[ 0 ];

}

if ( args.length > 1 )

{

maxConnections = Integer.parseInt( args[ 1 ] );

}

for ( int i = 0; i < maxConnections; i++ )

{

SingleConnection s = new SingleConnection( server, i );

s.start();

if ( i % 50 == 0 )

{

System.out.println( “Established " + i + " connections.” );

}

Thread.sleep( 100 );

}

}

}

Ciao Daniele,

Yep, I had that error two when running stress tests from Smack. I once tried to trace it but since it is very random I failed to catch it. My guess is that there is a timing issue while negotiating TLS between the server and the client. Moreover, since this problem only happens when using Smack then I think that this is a Smack issue that we need to solve.

To temporarily overcome this problem I used 2 different alternatives: 1) disabled TLS (that also improved the server performance) or 2) Implemented a retry logic in the stress test.

BTW, I have a few stress tests implemented so if you want to give them a try just let me know.

Ciao,

– Gato