Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix foreground process group on restart #904

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

gc00
Copy link
Contributor

@gc00 gc00 commented Mar 30, 2021

[ There's still a bug during restart in this PR. I'll fix that later. It's not yet ready for final review. the script test is failing to restart. ]
'
The key to reviewing this is to read the changes in src/terminal.cpp (i.e., the most recent commit: "Fix foreground process group on restart").

Without this PR, we have the bug described in Issue #903. The problem occurs when dmtcp_launch is called from a shell script instead of from the command line. On restart, the restarted process acts as if it's in background, and ^C (and other input?) does not reach the restarted process.

Sometimes 'dmtcp_launch' is called from inside a shell script (e.g., for a batch job). In this case, on restart, the foreground process group leader is the restarted process, and yet the process group leader is the parent (presumably the login shell). So, the foreground process group leader is not the leader of a process group. To fix this, we set the process group leader to also be the leader of the foreground process group.

 * This utility required to reset foregroup pgrp as needed in src/terminal.cpp.
@gc00 gc00 force-pushed the 3.0-fix-foreground-pgrp-on-restart branch 3 times, most recently from 6adf1a0 to c9fa28a Compare April 3, 2021 21:13
gc00 added 3 commits April 3, 2021 18:57
 * This utility required to reset foregroup pgrp as needed in src/terminal.cpp.
     * Sometimes 'dmtcp_launch' is called from inside a shell script
       (e.g., for a batch job).  In this case, on restart, the foreground
       process group leader is the restarted process, and yet the
       process group leader is the parent (presumably the login shell).
       So, the foreground process group leader is not the leader of a
       process group.  To fix this, we set the process group leader to
       also be the leader of the foreground process group.
@gc00 gc00 force-pushed the 3.0-fix-foreground-pgrp-on-restart branch 2 times, most recently from 6f0a40a to 8c4c464 Compare April 3, 2021 23:00
Comment on lines 159 to +160
MACRO(getpgrp) \
MACRO(_libc_getpgrp) /* src/plugin/pid/pid_syscallsreal.c */ \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MACRO(getpgrp) \
MACRO(_libc_getpgrp) /* src/plugin/pid/pid_syscallsreal.c */ \

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

Successfully merging this pull request may close these issues.

None yet

2 participants