Open edzius opened 11 years ago
seems reasonable, or else it should be an option. note that it is close on "exec" not close on "fork"
Oh, you are right.. i missed that. Yes it could be an option, however i can't figure out any scenario that these old socket descriptors would be used in switched process after exec()
Is there any reason not to use the
res = ioctl(fd, FIOCLEX, 0);
call instead?
We should probably make this an option. We can set it by default on all sockets. Windows doesn't seem to have an equivalent function. Is there similar funcionality on Windows?
Was this ever addressed? I just bumped into a similar issue.
Hi,
I want to suggest to add FD_CLOEXEC flag on TCP server sockets, to automatically close sockets on fork. I actually don't know if it left on purpose or it is a bug but in common use case it makes sense to close server sockets of forked process. I noticed this bug/feature while using luasockets v2.0.2 with xavante and wsapi.
My use case:
Forked process server sockets still open and when starting xavante again i get 'address already in use' error.
Here is my patch that i used on luasockets-2.0.2: