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

Don't put restored process on foreground if we are background process #14

Open
wants to merge 1 commit into
base: crac
Choose a base branch
from

Conversation

rvansa
Copy link
Member

@rvansa rvansa commented Oct 23, 2023

When the restore is executed in background (e.g. using java -XX:CRaCRestoreFrom=... &) and the restored process receives foreground forcefully, when this exits the parent shell (not on foreground) tries to read input and receives EOF, subsequently exiting. For users this might look as if the bash terminal gets suddenly closed for no reason at all.

Comment on lines +1068 to +1070
if (getppid() != tcgetpgrp(0)) {
pr_debug("Running in background, not setting foreground process");
} else if (root_item->pgid == vpid(root_item)) {
Copy link
Member

@AntonKozlov AntonKozlov Aug 7, 2024

Choose a reason for hiding this comment

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

Sorry for the delay with reply.

This is not a simple change as it involves the state on checkpoint and the state on restore. So we are not restoring control group if restore runs in background.

  1. Is it possible that we now leave some states where we should still be foreground? E.g. restoring in subshell like
$ ( ( java -XX:CRaCRestoreFrom= ... ) ) 

(no &, but parent probably not a foreground?)

  1. Can restoring in background negatively impact java process which may assume foreground?

  2. If the job moved to foreground (`java -XX:CRaCRestoreFrom= ... & ; fg), does it work correctly?

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