From owner-freebsd-questions@FreeBSD.ORG Mon Apr 28 03:00:48 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69F1E1065674 for ; Mon, 28 Apr 2008 03:00:48 +0000 (UTC) (envelope-from martincad@gmail.com) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.180]) by mx1.freebsd.org (Postfix) with ESMTP id 3B6BE8FC0C for ; Mon, 28 Apr 2008 03:00:48 +0000 (UTC) (envelope-from martincad@gmail.com) Received: by wa-out-1112.google.com with SMTP id k17so7038196waf.3 for ; Sun, 27 Apr 2008 20:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=9UQxQFi/GxwDeL5h13JQXODTkGGnmJ70meXQRoVOUNI=; b=DNYRYtmom2mC/q16d/AGzIkNZD5eUYVdp1j7Q/BV8qhGTXMDUtNmfV8dF6BFeHt5gl89sZxxP9o/jpb5mnqqF1aCO7058c+UCR7s5jrQVm5WoXo/mKrpDY2NGlSuPBkBJ10NO5onyo7LgpEi39nTw3N4hthrxEOJ4kc2YckSxTs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=TGW+fGQyeF1GBqBh/7BaeY5Qndagxxu6v+R7A5zqmAJDvhyu4FOCezMCr1curAlvsAQDDhnLbPjiXH9u8wHbeX6HYDgn1j+PqnBiADGWOGnfumW9LqfH2pi5r1MOZxzzYSUvFktVSPS5zr3xJYaCJOgg4FG9C0F5UH9WHU5MwpI= Received: by 10.114.14.1 with SMTP id 1mr5913389wan.183.1209350068724; Sun, 27 Apr 2008 19:34:28 -0700 (PDT) Received: by 10.114.67.15 with HTTP; Sun, 27 Apr 2008 19:34:28 -0700 (PDT) Message-ID: <2062979c0804271934v4208686dq5f02d9c2c21bde84@mail.gmail.com> Date: Sun, 27 Apr 2008 23:34:28 -0300 From: "Martin Candurra" To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Question behavior about socket syscall in release 6.2 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Apr 2008 03:00:48 -0000 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(20000, 30000)) 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(10000): 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.