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

Fix asyncdispatch drain behavior (#14820) #14838

Merged
merged 4 commits into from
Jun 30, 2020

Conversation

rayman22201
Copy link
Contributor

Drain was totally broken. Thanks to @D-Nice for pointing it out. This should be a better implementation.
I also made a tweak to the docs to make the behavior more clear, and added a test case based on the original #14820 report.
It should now have much more intuitive behavior.

@dom96 If you could please give me a code review I would very much appreciate it! Thanks! 😄 ❤️

@rayman22201
Copy link
Contributor Author

rayman22201 commented Jun 28, 2020

I'm investigating the Mac failures. It seems drain is ending one iteration early on Mac... because freaking Mac 😢

echo "async done"
done = true

discard somethingAsync()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this line is my fault, but just a heads up and maybe @dom96 would chime in that there's talk about forbidding discarding of futures (discardable pragma on async is already an error in devel), so maybe asyncCheck here instead would alleviate this becoming a blocker for such a PR in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, asyncCheck would be wise here

Copy link
Contributor

@dom96 dom96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, I think we can merge this.

echo "async done"
done = true

discard somethingAsync()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, asyncCheck would be wise here

@D-Nice
Copy link
Contributor

D-Nice commented Jun 28, 2020

Test passed fine on a macbook air:
https://i.imgur.com/N5VGSMw.png
https://i.imgur.com/lZn8lyW.png

@rayman22201
Copy link
Contributor Author

rayman22201 commented Jun 28, 2020

Test passed fine on a macbook air:
https://i.imgur.com/N5VGSMw.png
https://i.imgur.com/lZn8lyW.png

Really strange. I wonder why the Azure CI is failing the Mac build...
https://dev.azure.com/nim-lang/Nim/_build/results?buildId=6468&view=logs&j=30931762-47c4-53b3-6a83-316eb5a6b9d7&t=b1c7d701-c448-5ecb-905d-689d8a5921e0&l=1446

It looks like Azure is using MacOS 10.15.
It's also only failing on the C back end. The C++ backend succeeds.
edit: nope, latest re-run fails with the C++ backend also 😞

@rayman22201
Copy link
Contributor Author

I tried to reproduce on my own Macbook air with MacOS 10.15 and I can't get the test to fail.
I even tried running the entire test suite to see if it was some kind of interference from another test. It just works...

At this point I'm not sure what to do other than push a bunch of debug logging to the PR in order to get more details into what is going on inside Azure...

@rayman22201
Copy link
Contributor Author

After some help from Leorize on irc, it's because the Azure VM's are slow and can easily stall async. Slowing down the test by increasing the timeouts solved the problem.

I'm not sure I'm completely satisfied by this solution, but it's good enough for now, and hopefully good enough to merge.

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.

4 participants