PULL sockets connect to themselves preventing PUSH socket to bind

Description

I'm hitting a rather weird behaviour with PUSH/PULL sockets.
I create a simple PULL socket connecting to 100 different local ports (NO PUSH socket started yet)

After a while (1,2 minutes), I see the following output in netstat:
(I confess this is the first time I see a socket ESTABLISHED to itself in linux)

Given this state, when I try to create and bind the PUSH sockets I get "Address already in use"

I attached a simple program to show this behaviour.
Tested with zmq 2.1.10, 2.2.0, 2.2.1(git master), 3.2.0 (libzmq git master),same behaviour.

Any idea?

Environment

Linux amuraru 3.2.0-31-generic #50-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

Attachments

1

Activity

Show:

Martin Hurton October 25, 2012 at 6:50 PM

What you see is a socket connected to itself. This is enabled by simultaneous open feature of TCP. To avoid self-connect, do not connect to a port from ephemeral port range.

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created October 6, 2012 at 8:54 PM
Updated October 25, 2012 at 6:50 PM