From owner-freebsd-questions@FreeBSD.ORG Tue Sep 16 11:12:58 2014 Return-Path: <owner-freebsd-questions@FreeBSD.ORG> Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C931A4FA; Tue, 16 Sep 2014 11:12:58 +0000 (UTC) Received: from mail.tivas.info (85.234.217.139.static.edpnet.net [85.234.217.139]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF26EC58; Tue, 16 Sep 2014 11:12:56 +0000 (UTC) Received: from localhost.localdomain ([192.168.3.104]) by mail.tivas.info (8.14.4/8.14.4) with ESMTP id s8GBCg2V035927; Tue, 16 Sep 2014 13:12:42 +0200 (CEST) (envelope-from bram@diomedia.be) Message-ID: <54181B2A.7030908@diomedia.be> Date: Tue, 16 Sep 2014 13:12:42 +0200 From: Bram Van Steenlandt <bram@diomedia.be> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: Adrian Chadd <adrian@freebsd.org> Subject: Re: Listen queue guestion References: <5415EC27.40708@diomedia.be> <CAJ-VmomZ8PEn-6DUmF6HfRLcst72aRDVfiiiG_N1uBT3_nZJsw@mail.gmail.com> <54168ADA.6050204@diomedia.be> <CAJ-Vmo=0n=mx=mWWb+PPXfSezBubP1pmG2fHV2V-5Lh1TeE1Tg@mail.gmail.com> In-Reply-To: <CAJ-Vmo=0n=mx=mWWb+PPXfSezBubP1pmG2fHV2V-5Lh1TeE1Tg@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: FreeBSD Questions <freebsd-questions@freebsd.org> X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions <freebsd-questions.freebsd.org> List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-questions>, <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/> List-Post: <mailto:freebsd-questions@freebsd.org> List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help> List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>, <mailto:freebsd-questions-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 16 Sep 2014 11:12:59 -0000 Hi, I had not considered the queue size in python/twisted, stupid, I know. I was also asuming I was running into some sysctl limit because of the dmesg error (and the information I found online). Now it works (the queue size is 50 by default), from what I can see/test it works like this: I can set the queue size larger but setting it larger than sysctl kern.ipc.somaxconn has no point. The fact that you get the dmesg message doesn't mean the sysctl is set too low, it's just something freebsd detects. I think the connect/disconnectloop I was testing with just runs slower on the linux machine thus avoiding the problem. On freebsd if I connect & disconnect in a loop (for testing) the number of connection goes up (probably because it's not really closed yet when I do close). The handbook does say: The |kern.ipc.somaxconn| sysctl(8) <http://www.FreeBSD.org/cgi/man.cgi?query=sysctl&sektion=8> variable limits the size of the listen queue for accepting new |TCP| connections. https://www.freebsd.org/doc/handbook/configtuning-kernel-limits.html Thx Bram op 16-09-14 10:08, Adrian Chadd schreef: > Hm, ok. It's a UNIX domain socket. I kinda thought those also obeyed the sysctl. > > The sysctl has to be set -before- listen() is called. > > Also, in BSD, if the listen queue parameter to listen() is < 0, it > defaults to the sysctl maximum. > > > -a > > > On 14 September 2014 23:44, Bram Van Steenlandt <bram@diomedia.be> wrote: >> Hi, >> >> I use python, here the parameters are (socket.AF_UNIX,socket.SOCK_STREAM) >> >> Bram >> op 14-09-14 23:05, Adrian Chadd schreef: >> >>> Hi! >>> >>> What kind of sockets is it specifically using? >>> >>> >>> -a >>> >>> >>> On 14 September 2014 12:27, Bram Van Steenlandt <bram@diomedia.be> wrote: >>>> Hi, >>>> >>>> I'm porting an plc automation system to freebsd and while doing so I got >>>> errors like these: >>>> sonewconn: pcb 0xfffff8000cecc870: Listen queue overflow: 76 already in >>>> queue awaiting acceptance >>>> >>>> With the help of netstat I've found the problem, 2 programs communicate >>>> with >>>> ipc file like sockets and the "client" was connecting too fast (it was >>>> connecting and disconnecting in a small for loop). >>>> >>>> Still, on linux this worked and there will be cases where I may bump in >>>> to >>>> this limit again (a lot of different programs communicate with one master >>>> program over ipc). >>>> >>>> I've found kern.ipc.somaxconn but this seems to be only for TCP >>>> connections. >>>> >>>> Is there a sysctl or kernel parameter that allows me to set this queue a >>>> bit >>>> larger ? >>>> >>>> Thx >>>> Bram >>>> >>>> _______________________________________________ >>>> freebsd-questions@freebsd.org mailing list >>>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>>> To unsubscribe, send any mail to >>>> "freebsd-questions-unsubscribe@freebsd.org" >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to >>> "freebsd-questions-unsubscribe@freebsd.org" >> > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"