From: Eric Wong Date: 2011-07-21T09:08:08+09:00 Subject: [ruby-core:38284] Re: [Ruby 1.9 - Feature #5041] Set FD_CLOEXEC for all fds (except 0, 1, 2) Akira Tanaka wrote: > Eric Wong wrote: > > I support this proposal for Ruby 2.0. Very few applications depend on > > FD passing via exec() and they can easily be updated to set > > close_on_exec=false. > > > > I've just updated git://bogomips.org/unicorn.git myself. > I don't recommend io.close_on_exec = false for multithreaded programs. > There is a race condition which cause fd leakage if another thread invokes > system(). > (I guess unicorn has no problem because it is not multithreaded.) Yeah, and even in Rainbows!, threads only get used in the worker processes, not the master process[1] that calls exec() > So I may change the default of :close_others to true even for system() and > exec(). If so, I would like a way specify a set/array/hash of FDs/IOs we don't want :close_others to automatically close on us. [1] - Zbatery is a different story, but that's just one extra caveat to running with (optional) threads :< -- Eric Wong