Skip to content

Ensure sufficient stack size for worker threads #16

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

Merged

Conversation

ales-erjavec
Copy link
Contributor

@ales-erjavec ales-erjavec commented Nov 30, 2020

The default worker stack size for QThreadExecutor executor on macOS is insufficient to survive the default max recursion level.

I.e. The following fails with a SIGBUS error on macOS with Python 3.7.5

from qasync import QThreadExecutor

def func(a, *arg, **kwarg):
    func(a, *arg, **kwarg)

with QThreadExecutor(1) as executor:
    f = executor.submit(func, 1)
    assert isinstance(f.exception(), RecursionError)

Also it is impossible to use the official numpy wheel distributions with bundled openblas (numpy/numpy#11551) due to the default stack size.

The defaults in this PR are copied from https://github.com/python/cpython/blob/v3.9.0/Python/thread_pthread.h#L35

@codecov-io
Copy link

codecov-io commented Nov 30, 2020

Codecov Report

Merging #16 (f6a4bbb) into master (fd6ae27) will decrease coverage by 0.12%.
The diff coverage is 63.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
- Coverage   64.76%   64.64%   -0.13%     
==========================================
  Files           4        4              
  Lines         667      676       +9     
==========================================
+ Hits          432      437       +5     
- Misses        235      239       +4     
Impacted Files Coverage Δ
qasync/__init__.py 74.57% <63.63%> (-0.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd6ae27...f6a4bbb. Read the comment docs.

@TheGreatCabbage
Copy link
Member

Looks good, nice work!

@TheGreatCabbage TheGreatCabbage merged commit faab7a7 into CabbageDevelopment:master Dec 1, 2020
@TheGreatCabbage
Copy link
Member

TheGreatCabbage commented Dec 1, 2020

Now published in qasync==0.11.0.

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.

3 participants