Bug #1575
net.inet.tcp.blackhole and spawn-fcgi
| Status: | Fixed | Start: | ||
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assigned to: | - | % 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
Updated by stbuehler over 2 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 ;-)
Updated by Anonymous over 2 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
Updated by admin over 2 years ago
You're using IP sockets, while stbuehler is talking about Unix sockets.
Updated by stbuehler over 2 years ago
Oh... hehe. Should have seen the "tcp" in "net.inet.tcp.blackhole", sry.
Updated by stbuehler over 2 years ago
- Status changed from New to Fixed
- Resolution set to fixed
Fixed in r2106
Also available in: Atom