Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

close_on_exec flags on child process #2863

Open
washu opened this Issue · 6 comments

2 participants

@washu

when using puma in clustered mode (i.e. it forks a child) if that child process has a Process.span, popen, system or (backtick) call when that sub process of the child exists, it appears some file descriptors are inheriting and being closed resulting in non deterministic behaviour. Its behaving differeently than MRI 2.1.0

test case to see effect
1. stub any rails app
2. start rails using puma -w 1 (starts 1 worker process)
3. any action can be called with a ps -ef or something similiar
4. run as rbx .. worker process has its comm pipe to the parent closed, thinking it died.
5. run as mri and it works as expected.

@dbussink
Owner

Could you setup a Rails app that shows it? It makes it easier for us to reproduce because it also minimizes any chance of us screwing up reproducing the problem.

@washu

https://github.com/washu/haml_issue

start with puma -w 2 (2 workers) then hit the localhsot and use the link to 'slow'

@dbussink
Owner

So I just tried to run the repro, but it fails with this exception:

No such file or directory - /Users/dirkjan/Code/haml_issue/config/database.yml (Errno::ENOENT)

Can I just create a default database.yml file? Any reason it isn't included in the repro?

@washu

i pushed it up apparently it was in .gitignore by mistake. do a pull and you should be good to go

@washu

any updates?

@dbussink
Owner

No, I haven't had much time to further dig into this. In the initial digging I did I was more surprised that it works in MRI, since MRI also sets close_on_exec on file descriptors by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.