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

spin build blocking uninterruptibly after failed execution #2987

Closed
lann opened this issue Jan 23, 2025 · 4 comments · Fixed by #2991
Closed

spin build blocking uninterruptibly after failed execution #2987

lann opened this issue Jan 23, 2025 · 4 comments · Fixed by #2991

Comments

@lann
Copy link
Collaborator

lann commented Jan 23, 2025

As reported in fermyon/spin-js-sdk#313, a spin build

couldn't be exited with ctrl+c, only ctrl+z

Of note, this appeared (not yet verified) to have happened after the build subprocess returned:

Error: Build command for component hello-spin failed with status Exited(217)

Presumably something was handling SIGINT without terminating, though without being able to reproduce I'm not sure if that was Spin itself or some orphaned descendant process.

@itowlson
Copy link
Contributor

Looking at the original issue, the user report shows spin watch rather than spin build. Has this been observed with spin build too? spin watch does a bunch of extra stuff, and does set up a Ctrl+C handler.

@itowlson
Copy link
Contributor

Yeah I can repro this with spin watch if the first build fails. Investigating.

@itowlson
Copy link
Contributor

itowlson commented Jan 26, 2025

The problem happens because Ctrl+C handler sends a stop message (which happens correctly), but the loop that receives that message and responds to it by exiting is paused until after the first successful build (behaviour introduced in #2096). The build loop correctly circles back to the top and waits for changes (if you make a source code change, you'll see a rebuild), but until the first successful build, the stop message can't be processed.

(After a successful build, the second loop is unpaused. It will pause again temporarily during builds, but always resumes whether the build succeeded or failed. So stop message processing may get delayed but will happen.)

I think the fix is to pull the stop message receiver out into its own task, so that is can be included in the top level select and bring down the whole house without needing involvement from the change monitoring loops. I don't think that will terminate child processes correctly. Changing plans.

@itowlson
Copy link
Contributor

The simplest fix seemed to be to have the Ctrl+C handler unpause the loop that receives the message. PR sent.

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 a pull request may close this issue.

2 participants