Tue May 30 20:22:45 CEST 2000
On Tue, May 30, 2000 at 06:14:29PM +0100, Richard Barrett wrote:
> I raised the problem on this mailing list of multiple copies of epmd
> being spawned when multiple copies erl were run, each of which only
> knew about the instance of beam that spawned it. Further, all epmd
> instances were successfully listening on port 4369.
> Initial opinions in response were that this should be impossible and
> might be due to a screwed up kernel on my Suse 6.2 Linux controlled
Here from my copy (you can get one too!) of the 2.3.99pre8 kernel
sources is a longish comment on SO_REUSEADDR:
--- include/net/tcp.h:55 ---
/* There are a few simple rules, which allow for local port reuse by
* * an application. In essence:
* 1) Sockets bound to different interfaces may share a local port.
* Failing that, goto test 2.
* 2) If all sockets have sk->reuse set, and none of them are in
* TCP_LISTEN state, the port may be shared.
* Failing that, goto test 3.
* 3) If all sockets are bound to a specific sk->rcv_saddr local
* address, and none of them are the same, the port may be
* Failing this, the port cannot be shared.
* The interesting point, is test #2. This is what an FTP server does
* all day. To optimize this case we use a specific flag bit defined
* below. As we add sockets to a bind bucket list, we perform a
* check of: (newsk->reuse && (newsk->state != TCP_LISTEN))
* As long as all sockets added to a bind bucket pass this test,
* the flag bit will be set.
* The resulting situation is that tcp_v_verify_bind() can just
* for this flag bit, if it is set and the socket trying to bind has
* sk->reuse set, we don't even have to walk the owners list at all,
* we return that it is ok to bind this socket to the requested local
* Sounds like a lot of work, but it is worth it. In a more naive
* implementation (ie. current FreeBSD etc.) the entire list of ports
* must be walked for each data port opened by an ftp server. Needless
* to say, this does not scale at all. With a couple thousand FTP
* users logged onto your box, isn't it nice to know that new data
* ports are created in O(1) time? I thought so. ;-) -DaveM
Dunno if this helps...
SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380
C++ : an octopus made by nailing extra legs onto a dog
More information about the erlang-questions