Re: pen dies with "Error opening socket"

From: Chris Elsworth <>
Date: Wed, 28 Dec 2005 21:21:12 +0000

On Wed, Dec 28, 2005 at 09:42:56PM +0100, Dennis Thomas wrote:
> Hello,
> on a machine acting as a loadbalancer for some hosts the pen proccess
> dies every 1-3 Minutes. The last thing i can get in the log is "Error
> opening socket".
> I'm running FreeBSD 5.4 on the node, using pen 0.16. I checked if maybe
> there are too less sockets, but seems not to be the case:
> kern.ipc.numopensockets: 4442
> kern.ipc.maxsockets: 12328


The only occurrence of this error in pen.c is when socket() returns
failure. man socket reveals that on FreeBSD, the call may fail for any
of the following reasons:

EPROTONOSUPPORT: not applicable, since AF_INET SOCK_STREAM/ is right
there in the source and that will work fine

EMFILE: potentially a problem, check with ulimit -n for this. It's
probably in the order of a few thousand, so unlikely.

EACCES: unlikely, if it's working for a while then you have permission
to create sockets as that user.

ENOBUFS: most likely the cause; try netstat -m and see if your mbuf
clusters are maxed out next time it happens. Raising maxusers will
allocate more mbufs and thus fix this. (kern.maxusers)

Hacking the source to provide you with the errno may prove some help.

change from:
if (upfd < 0) error("Error opening socket");
change to:
if (upfd < 0) error("Error opening socket: %d", errno);

Received on Wed Dec 28 2005 - 22:21:15 CET

This archive was generated by hypermail 2.2.0 : Wed Dec 28 2005 - 22:21:15 CET