Project

General

Profile

Actions

Bug #1575

closed

net.inet.tcp.blackhole and spawn-fcgi

Added by Anonymous over 16 years ago. Updated over 16 years ago.

Status:
Fixed
Priority:
Low
Category:
spawn-fcgi
Target version:
ASK QUESTIONS IN Forums:

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

Actions #1

Updated by stbuehler over 16 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 ;-)

Actions #2

Updated by Anonymous over 16 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

Actions #3

Updated by admin over 16 years ago

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

Actions #4

Updated by stbuehler over 16 years ago

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

Actions #5

Updated by stbuehler over 16 years ago

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

Fixed in r2106

Actions

Also available in: Atom