jeromq icon indicating copy to clipboard operation
jeromq copied to clipboard

Jeromq on Windows 7 creates more than 20 ports when a socket is created.

Open Zhichao-Hong opened this issue 10 years ago • 7 comments

The jdk version is 1.8.0_51 (64bit) version. OS is windows 7 x64. The jeromq version is 0.3.5.

Note, the same behavior is not exhibited on OSX.

Here is the dump from the tcpview. And only the ports 5556 (PULL) and 5557(REP) should be open.

java.exe    11216   TCP MACHINE1    59542   localhost   59544   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59543   localhost   59545   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59544   localhost   59542   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59545   localhost   59543   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59546   MACHINE1    0   LISTENING                                       
java.exe    11216   TCP MACHINE1    59547   MACHINE1    0   LISTENING                                       
java.exe    11216   TCP MACHINE1    59548   localhost   59546   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59549   localhost   59547   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59550   localhost   59552   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59551   localhost   59553   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59552   localhost   59550   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59553   localhost   59551   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59554   localhost   59555   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59555   localhost   59554   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59556   MACHINE1    0   LISTENING                                       
java.exe    11216   TCP MACHINE1    59557   localhost   59558   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59558   localhost   59557   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59559   localhost   59556   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59560   localhost   59561   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59561   localhost   59560   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59562   localhost   59563   ESTABLISHED 1   1   1   8                       
java.exe    11216   TCP MACHINE1    59563   localhost   59562   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59564   localhost   59567   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59565   localhost   59566   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59566   localhost   59565   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59567   localhost   59564   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59568   localhost   59569   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59569   localhost   59568   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59570   localhost   59573   ESTABLISHED 1   1   1   8                       
java.exe    11216   TCP MACHINE1    59571   localhost   59572   ESTABLISHED 1   1   1   8                       
java.exe    11216   TCP MACHINE1    59572   localhost   59571   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59573   localhost   59570   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59574   localhost   59575   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59575   localhost   59574   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    5556    MACHINE1    0   LISTENING                                       
java.exe    11216   TCP MACHINE1    59576   localhost   59577   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59577   localhost   59576   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59578   localhost   59579   ESTABLISHED 1   1   1   8                       
java.exe    11216   TCP MACHINE1    59579   localhost   59578   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    59580   localhost   59581   ESTABLISHED         1   8                       
java.exe    11216   TCP MACHINE1    59581   localhost   59580   ESTABLISHED                                     
java.exe    11216   TCP MACHINE1    5557    MACHINE1    0   LISTENING   

Zhichao-Hong avatar Nov 04 '15 15:11 Zhichao-Hong

I have done a similar testing with Python PyZMQ to compare the jeromq with native zeromq implementation. In native ZeroMQ, when a context is created, there were 2 TCP ports open. When a socket is created for that context, 6 additional TCP ports were open. In the end, when a socket is bound to listening port, the port was open. In total, there are 9 TCP ports used, which is still 50% less than jeromq. I am wondering if there is a way to control the number of ports gets open by jeromq.

Zhichao-Hong avatar Nov 05 '15 16:11 Zhichao-Hong

That seems odd. Unfortunately, I don't have a windows machine to test on to recreate this scenario. Hopefully, someone else from the community will be able to corroborate.

trevorbernard avatar Nov 05 '15 17:11 trevorbernard

Information needed:

  • An explanation from someone who understands this part of the code.
    • In what part of the code are these ports ultimately created?
    • Is there any place where it's possible that "duplicate" ports can be created?
    • What does it mean to "create a port," exactly?
  • Do we think this issue may have resolved in the almost-two-years since it was created?

daveyarwood avatar Oct 05 '17 03:10 daveyarwood

It's been almost 3 years since this issue was created and we have no reports that it's still an issue with the latest version. Closing the issue for now -- feel free to reopen if the issue persists in the latest version of JeroMQ.

daveyarwood avatar Oct 28 '18 00:10 daveyarwood

I am seeing the same thing with jeromq 0.4.3 on Windows 10, jdk 1.8.0_201.

AFAICT this is easily reproductible, it happens 100% of the time, tried on two separate machines.

pm47 avatar Feb 07 '19 10:02 pm47

OK -- reopening :)

daveyarwood avatar Feb 07 '19 14:02 daveyarwood

Update to this issue: Five years after issue creation (nearly even to the day) the problem still exists in jeromq release 0.5.2.

I just created a test application with 'Simple example' code from README [https://github.com/zeromq/jeromq#simple-example] and I also can see 20 ports being open. My environment consists of Windows 10 and openjdk-12.

The strange thing is that the open ports are connected to each other mutually in pairs of two - so there are two times ten ports connected:

grafik

DerTomm avatar Nov 06 '20 11:11 DerTomm