Commit 77f2b81
committed
Set SOCK_CLOEXEC for debugger sockets
It's possible to configure HHVM access logs to be sent to a subprocess
instead of a file, like so:
```
Log {
Access {
* {
File = |/usr/bin/some_processor.sh | tee -a /tmp/hhvm-access.log
}
}
}
```
Under the hood, this is backed by a `popen(3)` syscall in
`ClassicWriter`, which ultimately creates a pipe, forks and invokes a
shell. If HHVM is running with the debugger enabled
(`hhvm.debugger.vs_debug_enable=1`), this subprocess also ends up
inheriting the file descriptor backing the listening socket of the
debugger. If a connected debugger client then disconnects,
the debug server will then restart and try to open a new socket, but fail
because the FD remains open in the child process.
So, set `SOCK_CLOEXEC` on these sockets so that they get closed in child
processes.1 parent 31e40e9 commit 77f2b81
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
305 | | - | |
| 306 | + | |
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| |||
360 | 361 | | |
361 | 362 | | |
362 | 363 | | |
363 | | - | |
| 364 | + | |
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
| |||
0 commit comments