A tool to stress test a websockets b4j server?
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)
at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1587)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:334)
at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:533)
at org.eclipse.jetty.util.thread.ScheduledExecutorScheduler.schedule(ScheduledExecutorScheduler.java:111)
at org.eclipse.jetty.io.ManagedSelector$Connect.<init>(ManagedSelector.java:614)
at org.eclipse.jetty.io.SelectorManager.connect(SelectorManager.java:190)
at org.eclipse.jetty.websocket.client.io.ConnectionManager$PhysicalConnect.run(ConnectionManager.java:76)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
at java.lang.Thread.run(Thread.java:745)
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at org.eclipse.jetty.util.thread.QueuedThreadPool.startThreads(QueuedThreadPool.java:462)
at org.eclipse.jetty.util.thread.QueuedThreadPool.doStart(QueuedThreadPool.java:113)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.addManaged(ContainerLifeCycle.java:343)
at org.eclipse.jetty.websocket.client.WebSocketClient.initializeClient(WebSocketClient.java:465)
at org.eclipse.jetty.websocket.client.WebSocketClient.connect(WebSocketClient.java:198)
at org.eclipse.jetty.websocket.client.WebSocketClient.connect(WebSocketClient.java:155)
at anywhersoftware.b4j.objects.WebSocketClientWrapper$1.run(WebSocketClientWrapper.java:51)
at java.lang.Thread.run(Thread.java:745)
WebSocket Closed: unable to create new native thread
Sub Btniniciar_MouseClicked (EventData As MouseEvent)
If Txtnmaquinas.Text<>"" Then
Dim wsc(Txtnmaquinas.Text) As WebSocketHandler
For i = 0 To Txtnmaquinas.Text -1
Try
wsc(i).Initialize(Me, "wsh")
wsc(i).Connect(serverLink)
TxtLog.Text=TxtLog.Text & I & CRLF
Log(i)
Catch
TxtLog.Text=TxtLog.Text & LastException & CRLF
Log(LastException)
End Try
Next
Else
End If
End Sub
If I remember well (this happens... never ) Erel's tests work well with 2,000 connections.
He will understand better the error message (also because I read not well ) but I think "instinctively" to two possible problems:
1) I would create a new connection (websocket) in the Connected event of the previous connection
2) (less likely) device memory problems