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

yesod devel places stack build --file-watch in a "stopped by job control" state #1860

Open
kabuhr opened this issue Feb 17, 2025 · 1 comment

Comments

@kabuhr
Copy link

kabuhr commented Feb 17, 2025

On Linux, following the instructions in the quick start with Stack 3.3.1 and invoking the development server with stack exec -- yesod devel, the server performs an initial build but fails to respond to help or other commands and does not rebuild when files are changed or when you attempt to force a rebuild with an empty input line. The output of ps jx shows that the stack build --file-watch subprocess has been placed in a stopped state (process state code T=stopped by job control signal), similar to a process backgrounded by a shell that is waiting on input.

The culprit appears to be commit b3ed4613. This places the subprocess in its own process group, which no longer matches the foreground process group for the controlling terminal, so when the stack --file-watch process attempts to read user input, it's treated like a job-controlled background process and placed in a stopped state.

The commit is five years old, so I have no idea why this bug has only surfaced now. Perhaps a change was made to input handling for stack --file-watch, or perhaps so few people use yesod devel these days that it takes five years to notice it isn't working (!?).

The simplest fix seems to be just deleting the setCreateGroup True decoration. Neither setDelegateCtlc nor setCreateGroup should be needed here, as far as I can see. In my testing with no decoration, the three processes (the controlling yesod devel process, the stack build --file-watch process, and the app/devel.hs server process) all seem to shut down fine whether you issue the quit command or hit Ctrl-C. This is expected: in the former case, the stack build --file-watch process exits cleanly, ending the race_; in the latter case, the default behavior with no setDelegateCtlc or setCreateGroup is to deliver SIGINT to all three processes in the process group, killing them all.

@jezen
Copy link
Member

jezen commented Feb 18, 2025

or perhaps so few people use yesod devel these days that it takes five years to notice it isn't working (!?)

This is certainly possible. Everyone I know uses GHCi directly instead.

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

No branches or pull requests

2 participants