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

Race condition in yesod-bin #1380

Closed
psibi opened this Issue Apr 20, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@psibi
Member

psibi commented Apr 20, 2017

In some scenarios, yesod-bin (or the yesod executable) is always in the "compiling" state of the web application, even when the application has been compiled successfully. I verified this, by going to the random PORT which yesod-bin creates and reverse proxies to. Going to the random PORT, I can see the web application working properly. But the $DISPLAY_PORT was still in compilation "refreshing" page.

After doing lot of instrumentation in the yesod-bin code, I found the reason being this:

atomically (writeTVar appPortVar (-1))

In some scenarios, the above function was called even after yesod-devel/rebuild file was successfully generated.

My proposed fix for this is to call the function only when stack emits ExitFailure. I already have a private working branch where this solution is hugely relieving to me. I will send a PR once my other team members try out the solution and don't encounter any new bugs.

Meanwhile, I'm looking for feedback of the above proposed solution. Note that, I tried to fix this in various ways (going through MVar route for synchronization, etc) but at the end this seemed to be the most obvious way.

@psibi

This comment has been minimized.

Show comment
Hide comment
@psibi

psibi Apr 28, 2017

Member

Fixed in #1381

Member

psibi commented Apr 28, 2017

Fixed in #1381

@psibi psibi closed this Apr 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment