The attached Java program will crash around 64470 iterations when MAX_ITERATIONS is set to 50000. If you change MAX_ITERATIONS to 5000 the program is stable and will not crash. When the program crashes it kills the JVM and does not give java an opportunity to catch an exception. I've attached the JVM crash log. I suspect this has something to do with JVM garbage collection and thats why the MAX_ITERATION makes a difference. The program is stable if I do not open/close the connections in each iteration. Is there a way to make this stable?
what is your version of jzmq and libzmq?
The attached code works fine with the latest jzmq and libzmq on linux and osx.
Need to verify this is Windows issue or version issue.
The version of ZMQ is 3.2.1-rc2 the version of jzmq is 2.1.0 (according to the jzmq.spec file)
zmq.jar, jzmq.dll, libzmq.dll
I don't have win7 now and tried with the latest libzmq and jzmq after compiling them with visual studio express 2010 on my winxp machine.
I've attached my compiled files. Please recompile your example and run with the attachments.
My Test was..
Hello World Iteration # 167420
Hello World Iteration # 167421
Hello World Iteration # 167422
Hello World Iteration # 167423
""The program is stable if I do not open/close the connections in each iteration. Is there a way to make this stable?""
Opening/closing sockets 50000 times is probably not the best choice, doing so creates enormous overhead in the jvm/os...keep the socket open and reuse it, that's certainly a better option. I posted a question on stackoverflow along the same lines, Pieter responded with a comment that appears to be related to your issue of repeatedly creating/destroying sockets...