I wrote a test client for some jRDC2 testing in B4J non-gui mode. I then had a batch file start as many sessions of that client for me. I'm attaching source for both the client and the batch file and hopefully it gives some inspiration. Please note that this client was adapted for a heavily modified jRDC2 server that I was using to test various SQL pooling options (H2, HSQLDB, Hikari, Tomcat, Vibur, and 3CP0) and pooling/JDBC properties. I was also testing various DB engines (H2, Apachy Derby, SQLite, HSQLDB, and MySQL). I'll throw in the config.properties file so you can find the SQL statement that was used for testing. It's not a canned project for you, but it may help you (hopefully) in your endeavors.
Oliver,
I was able to run your test program just fine without any errors. I converted my test app into a command line B4J app and used a similar batch file. It works fine if I run it with only 1 or 2 clients but if I try 5 or more clients I start getting errors on the client. Some of the errors complain about file sharing which is odd because the client does not access any text files or config files. It only accesses the jRDC2 server. Even with a lot of Try/Catch statements I can't find the code that throws the exception.
The jRDC2 server runs fine without any errors.
If I run a single client in a DOS window it runs fine. As soon as I start running 3 or more clients I start getting exceptions in some of the client windows.
On the client (client is compiled as Release and run as Admin on Win10) I will see errors either right away or after a few iterations, like:
(FileNotFoundException) java.io.FileNotFoundException: C:\Users\User1\AppData\Local\Temp\465 (The process cannot access the file because it is being used by another process)
ERROR: StartMessageLoop aborted!!!! Exception: java.io.FileNotFoundException: C:\Users\User1\AppData\Local\Temp\465 (The process cannot access the file because it is being used by another process)
I can reduce the number of times the error above occurs by adding a "TimeOut 3" inside the batch file to delay loading the next benchmark app by 3 seconds. But the error can still appear later after a few iterations, only less frequently around 10% of the time.
Now if I run 10 clients, 8 of them will complete without errors and two of them will produce this error after several iterations:
java.lang.RuntimeException: java.util.zip.ZipException: invalid distance too far back
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:297)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:357)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:112)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:82)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:93)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:1)
at anywheresoftware.b4a.BA$4.run(BA.java:272)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.zip.ZipException: invalid distance too far back
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at java.io.DataInputStream.readFully(DataInputStream.java:195)
at java.io.DataInputStream.readFully(DataInputStream.java:169)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:327)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readMap(B4XSerializator.java:231)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:347)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readMap(B4XSerializator.java:231)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:275)
... 11 more
[HandleJobAsync] Error reading response: (ZipException) java.util.zip.ZipException: invalid distance too far back
Same with this error. If I run 10 clients, 8 of them will complete without errors and two of them will produce this error after several iterations:
[GetQuestions] ERROR: java.lang.NullPointerException
java.lang.RuntimeException: java.lang.RuntimeException: Unsupported type: 52
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:297)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:357)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:112)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:82)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:93)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator$2.call(B4XSerializator.java:1)
at anywheresoftware.b4a.BA$4.run(BA.java:272)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Unsupported type: 52
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:359)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readMap(B4XSerializator.java:231)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:347)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readMap(B4XSerializator.java:231)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:275)
... 11 more
[HandleJobAsync] Error reading response: (RuntimeException) java.lang.RuntimeException: Unsupported type: 52
Everything works fine if I run only 1 or 2 clients at the same time. There are never any errors on the jRDC2 server.
Have you experienced this problem before? Any idea what it is complaining about?
TIA