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

Live Reload has a deadlock in v2 #807

Closed
kentquirk opened this issue Jul 26, 2023 · 0 comments · Fixed by #810
Closed

Live Reload has a deadlock in v2 #807

kentquirk opened this issue Jul 26, 2023 · 0 comments · Fixed by #810
Labels
type: bug Something isn't working
Milestone

Comments

@kentquirk
Copy link
Contributor

The reload code in v2 has a deadlock -- inside monitor(), there's a lock around the reload, but the lock also encloses the callbacks. This requires access to config values that are now write-locked. This wasn't detected in testing because we didn't set up callbacks in testing.

			f.mux.Lock()
			f.mainConfig = cfg.mainConfig
			f.mainHash = cfg.mainHash
			f.rulesConfig = cfg.rulesConfig
			f.rulesHash = cfg.rulesHash
			for _, cb := range f.callbacks {
				cb()
			}
			f.mux.Unlock() 

The Unlock() needs to move up above the callbacks.

@kentquirk kentquirk added the type: bug Something isn't working label Jul 26, 2023
@kentquirk kentquirk added this to the v2.1 milestone Jul 27, 2023
kentquirk added a commit that referenced this issue Jul 28, 2023
## Which problem is this PR solving?

- Live reload deadlock seen in #807

## Short description of the changes

- Move unlock above the callbacks, fix comment

Fixes #807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant