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

Monitor exiting on EOF #20

Open
nuno-silva opened this issue Dec 16, 2014 · 5 comments
Open

Monitor exiting on EOF #20

nuno-silva opened this issue Dec 16, 2014 · 5 comments

Comments

@nuno-silva
Copy link
Owner

Running proj-so/src$ ./monitor < ../inputs/1.in, monitor quits (sending a signal to writer_parallel) even before the child process has time to call execl("writer_parallel");. After re-reading Exercise 5.pdf, I realized it does not mention that the monitor should quit on EOF, which we are currently doing. It is, however, silly not to quit on EOF, since then how would we receive the quit command (sair) from stdin? Perhaps it should run forever?

@Keyaku
Copy link
Collaborator

Keyaku commented Dec 16, 2014

I believe it should not quit on EOF, but just stop, as if it's receiving SIGTSTP. Could be wrong, though.

@nuno-silva
Copy link
Owner Author

Our current monitor implementation does not handle any signals and, for what I understand, Exercise 5.pdf does not mention signal handling for monitor (besides sending SIGTSTP to the writer).

@nuno-silva nuno-silva added this to the Public release milestone Dec 16, 2014
@nuno-silva
Copy link
Owner Author

What do you mean, stop?

@Keyaku
Copy link
Collaborator

Keyaku commented Dec 17, 2014

Euh… never mind, my mistake.

@nuno-silva
Copy link
Owner Author

This issue could be considered a bug because when stdin reaches EOF, sometimes monitor will call exit_monitor() even before writer_parallel starts running main(), so when it sends the SIGTSTP signal to writer_parallel it has not yet registered the signal handler, causing it to default to the default SIGTSTP behavior (which causes the process to suspend execution), effectively blocking the monitor.

However, the workaround for #19 on 4181c33 prevents this from happening: with monitor sleeping, writer_parallel has plenty of time to register its signal handler(s).

nuno-silva added a commit that referenced this issue Feb 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants