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

Deadlock when using bg module loading under nose testing #9

Open
paulie-g opened this issue Apr 5, 2019 · 2 comments
Open

Deadlock when using bg module loading under nose testing #9

paulie-g opened this issue Apr 5, 2019 · 2 comments

Comments

@paulie-g
Copy link

paulie-g commented Apr 5, 2019

I patched @gleitz 's howdoi to load pygments in a background thread with lazyasd. The code worked. The unit tests passed when run by hand. Speed-up was achieved. I rejoiced. @gleitz merged my two-line PR. Then Travis failed.

Looking at the strace -f, it appears the background thread is blocking on a futex and the main doesn't progress either. Deadlock. Specifically, it's deadlocking at the top of BackgroundModuleLoader.run(). In an attempt to debug this and see if it can be avoided, I implemented all the stuff in PR #8 .

As it happens, the only thing that works to avoid the deadlock is avoiding the time.sleep() there. It bothers me that I still don't understand why nose is triggering this. Even stranger, nosetests-2.7 deadlocks on my machine but not on Travis. On the other hand, this whole thing was meant to be a 5 minute 2 sloc PR to speed up a tool I use on occasion. When I found myself looking through cpython to see if the GIL is being released on time.sleep(), I realized that this rabbit hole is in danger of swallowing the rest of my week ;)

In an ideal world, I'd like:

Sadly, we live in an imperfect world. Cheers for your work on lazyasd and xonsh ;)

@gleitz
Copy link

gleitz commented Apr 5, 2019

@paulie-g thanks for the in-depth exploration

@scopatz
Copy link
Member

scopatz commented May 24, 2019

Thanks for this @paulie-g!

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

No branches or pull requests

3 participants