Bug #1575

net.inet.tcp.blackhole and spawn-fcgi

Added by Anonymous almost 7 years ago. Updated almost 7 years ago.

Status:FixedStart date:
Priority:LowDue date:
Assignee:-% Done:

0%

Category:spawn-fcgi
Target version:1.5.0
Missing in 1.5.x:

Description

When setting net.inet.tcp.blackhole > 0 on the FreeBSD, spawn-fcgi hangs trying to accomplish the connect syscall on 94'th line of the spawn-fcgi.c:

if (-1 == connect(fcgi_fd, fcgi_addr, servlen)) {

As I understand, this is a simple check for the port availability which can't be accomplished due to the blackhole option activated. As soon as I deactivate the blackhole option, spawn-fcgi spawns correctly.

I suggest to get rid of this check, because later we call a 'bind' syscall anyway, which also returns error in case if the port is already in use. Why do we do redundant checking ?

Additionally it will also fix the things with the FreeBSD blackhole feature.

Here is a diff for review: www.freebsd.az/other/spawn-fcgi.patch

-- tofig

History

#1 Updated by stbuehler almost 7 years ago

Did you try what happens if you start spawn-fcgi a second time?

I think it will delete the first socket (unlink in the source), and create a new one - and then you have 2 fcgi processes running, but the first one is unreachable as its socket is deleted (but not closed); check by killing the second one (with all childs) and try connecting to it (e.g. with the original spawn-fcgi). (Tested on my linux box)

Please give feedback how FreeBSD behaves ;-)

#2 Updated by Anonymous almost 7 years ago

When I start the second instance of the unpatched spawn-fcgi it gives me:
spawn-fcgi.c.224: socket is already used, can't spawn
and exits.

With the patch applied it gives me:
spawn-fcgi.c.118: bind failed: Address already in use
and exits.

-- tofig

#3 Updated by admin almost 7 years ago

You're using IP sockets, while stbuehler is talking about Unix sockets.

#4 Updated by stbuehler almost 7 years ago

Oh... hehe. Should have seen the "tcp" in "net.inet.tcp.blackhole", sry.

#5 Updated by stbuehler almost 7 years ago

  • Status changed from New to Fixed
  • Resolution set to fixed

Fixed in r2106

Also available in: Atom