Skip to content

Conversation

@sanderheijselaar
Copy link

No description provided.

@timkay
Copy link
Owner

timkay commented Apr 10, 2014

Why does a fork help? You run the code in a child process and wait for that child to finish. The original code execs the child process, which exits when it finishes. Seems to me it's the same effect without the extra process. Please explain the subtlety I am missing.

@sanderheijselaar
Copy link
Author

I use your script on many of my servers but it failed on one server and I couldn't find out why. it happens in another process which starts something with solo. when this process ends, it also ends the solo process and because of that other command with solo and the same port are executed again. this only happens on one server, which has the same base image and puppet scripts as the other servers i have. This little tweak solved the problem. I hope my explaination is clear.

@timkay
Copy link
Owner

timkay commented Apr 11, 2014

I don't think I understand. You said that you are running identical
configurations, across servers, and only one of them has a problem. I think
you said that the same command runs a second time somehow. Is that the
problem?

My big issue is that I don't see how fork/wait would change the behavior,
unless the exec'd process closes the bound socket (probably file descriptor
3). In that case, your change would prevent it. However, it also breaks a
use case where the exec'd process deliberately closes fd 3, to allow
another copy to run.

...Tim

On Fri, Apr 11, 2014 at 7:32 AM, sanderheijselaar
notifications@github.comwrote:

I use your script on many of my servers but it failed on one server and I
couldn't find out why. it happens in another process which starts something
with solo. when this process ends, it also ends the solo process and
because of that other command with solo and the same port are executed
again. this only happens on one server, which has the same base image and
puppet scripts as the other servers i have. This little tweak solved the
problem. I hope my explaination is clear.

Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-40209745
.

Tim Kay
m: +1-650-248-0123
Skype: timkay

@sanderheijselaar
Copy link
Author

I have a php process that does a exec. This exec has the solo script in front so it will only run once. But when the php process stops, the solo scripts also stops and closes the bound socket.
I run multiple php processes that all do the exec with the solo script (and the php process stops right after the exec), so it get's to run every time. This only happens on one server. On the other servers the 1.6 version works fine. That's why I've added the code on the bottom. With that is works on all my machines. If this fix adds a bug on your system, maybe it can be added as a parameter to the command? So people can use it when they had the same problem as I did? Or maybe we can improve this fix so the bug will not occur on your machines.

@timkay
Copy link
Owner

timkay commented Apr 14, 2014

I missed something in your explanation. You said

"I run multiple processes.... This only happens on one server."

What you said before "This" does not indicate a problem. My read is that
the "this" refers to the problem you didn't indicate.

On Mon, Apr 14, 2014 at 4:54 AM, sanderheijselaar
notifications@github.comwrote:

I have a php process that does a exec. This exec has the solo script in
front so it will only run once. But when the php process stops, the solo
scripts also stops and closes the bound socket.
I run multiple php processes that all do the exec with the solo script
(and the php process stops right after the exec), so it get's to run every
time. This only happens on one server. On the other servers the 1.6 version
works fine. That's why I've added the code on the bottom. With that is
works on all my machines. If this fix adds a bug on your system, maybe it
can be added as a parameter to the command? So people can use it when they
had the same problem as I did? Or maybe we can improve this fix so the bug
will not occur on your machines.


Reply to this email directly or view it on GitHubhttps://github.com//pull/2#issuecomment-40357886
.

Tim Kay
m: +1-650-248-0123
Skype: timkay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants