Question about socket syscall in release 6.2

2008-04-29 Thread Martin Candurra
I have found some weird behavior about the socket system call in freebsd
release 6.2.
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:

import os
import socket
from random import randint
import sys
socketAddress = (127.0.0.1, randint(2, 3))


s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(socketAddress)
s.listen(1)

socketList = []
child = -1
for i in range(1):

child = os.fork()
if (child):
clientCon, address = s.accept()
socketList.append(clientCon)
os.waitpid(0, os.WNOHANG)
else:
print child %d % i
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if (clientSocket==-1):
print(client socket error)
err = clientSocket.connect(socketAddress)
if (err==-1):
print(client connect error)
break



Is there something I'm missing ? Can someone shed me some light about this ?

Thanks in advance.

Best regards.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Question behavior about socket syscall in release 6.2

2008-04-27 Thread Martin Candurra
I have found some weird behavior about the socket system call in freebsd
release 6.2.
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:

import os
import socket
from random import randint
import sys
socketAddress = (127.0.0.1, randint(2, 3))


s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(socketAddress)
s.listen(1)

socketList = []
child = -1
for i in range(1):

child = os.fork()
if (child):
clientCon, address = s.accept()
socketList.append(clientCon)
os.waitpid(0, os.WNOHANG)
else:
print child %d % i
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if (clientSocket==-1):
print(client socket error)
err = clientSocket.connect(socketAddress)
if (err==-1):
print(client connect error)
break



Is there something I'm missing ? Can someone shed me some light about this ?

Thanks in advance.

Best regards.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]