Closed andrew-stripe closed 7 years ago
Do you have any understanding of why this bug happened? It's extremely baffling to me why that might be the case.
:+1:
though if we're reasonably confident this resolves things.
After an IRL and some more digging in the Ruby codebase I still can't figure out where getcwd
is being called in the exec
flow nor why Dir.chdir
would create problems with the number of open files. Going to go ahead and merge since I pretty clearly broke something... but I really wish I understood what's going on here.
Note to reviewers: The first commit here is a straight revert of #29. I'd suggest reviewing only the second commit (note that commit bumps the version two numbers because the revert rolled it back).
Using
FileUtils.cd
(an alias forDir.chdir
) triggers a warning message when Subprocess is called with the cwd arg from inside another chdir block: https://github.com/ruby/ruby/blob/v2_4_1/dir.c#L1033-L1034In #29, I tried fixing this by using the block form of
Dir.chdir
but that caused many people to see errors of the form:Instead of calling
chdir
in Ruby, I think it makes more sense to passchdir
as an argument to exec.I still have to call
Dir.chdir
around apreexec_fn
so that it continues to operate in the new working directory. We don't depend on that behavior anywhere at Stripe but it's possible someone else does. I suspect the bug was some interaction betweenDir.chdir
andexec
so this feels safe.cc @stripe/product-infra r? @nelhage