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

Fixed build and SIGINT race condition and massive sleep after SIGINT #177

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

Conversation

ryanolds-drizly
Copy link

This PR addresses two issues. The bigger issue is a race condition that I was seeing when send_interrupt config is true.

When Air successful builds and runs the binary the e.binRunning is set to true. If then the build fails twice before e.killCmd(...) completes (takes 30 second due to sleeping after sending SIGINT) the build logics sends two messages (e.binRunning is still true) to the binStopCh channel, the 2nd message resulting in a block in the middle of e.withLock, holding the lock until the channel has room. When the attempt to kill the previous running command finishes sleeping, it cannot get the lock to set e.binRunning to false resulting in a dead lock.

This PR moves the setting of Engine.binRunning to false before trying to interrupt/kill the running process, avoiding the the race condition.

The 2nd issue is the sleep was being multiplied by time.Milliseconds which was resulting in the duration being multiplied by 1M (see the constants at the bottom of the section at https://golang.org/pkg/time/#pkg-constants).

I also adjusted some white space and returns in the runner/util_linux.go and runner/util_darwin.go to match.

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.

None yet

1 participant