Question behavior about socket syscall in release 6.2
martincad at gmail.com
Mon Apr 28 03:00:48 UTC 2008
I have found some weird behavior about the socket system call in freebsd
The problem appears if I try to open more sockets than the ulimits allows:
the socket system call gets blocked instead of returning an EMFILE error.
This only happens to me in release 6.2 ( I tested in 7.0 but it works fine).
The following python script is what I have used to reproduce the issue:
from random import randint
socketAddress = ("127.0.0.1", randint(20000, 30000))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
socketList = 
child = -1
for i in range(10000):
child = os.fork()
clientCon, address = s.accept()
print "child %d" % i
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("client socket error")
err = clientSocket.connect(socketAddress)
print("client connect error")
Is there something I'm missing ? Can someone shed me some light about this ?
Thanks in advance.
More information about the freebsd-questions