Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Crash when setting up a tasklet belonging to a different thread #60

Closed
ghost opened this issue Apr 20, 2014 · 7 comments
Closed

Crash when setting up a tasklet belonging to a different thread #60

ghost opened this issue Apr 20, 2014 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2014

Originally reported by: Kristján Valur Jónsson (Bitbucket: krisvale, GitHub: kristjanvalur)


The attached file demonstrates a crash recently discovered. If a tasklet created on a different thread gets setup, it crashes. This occurs because a cstack is being allocated using the wrong thread state.
This happens because of a call to "slp_ensure_linkage" in the "bind_task_to_frame" call. If this call is omitted, then all runs fine. But then we have failures in the unittests.

I have never understood what the slp_ensure_linkage is supposed to do. I would like to fix this without complicating the cstack allocation by using the task's thread state. What is the slp_ensure_linkage supposed to be doing?

tcrash.py.zip


@ghost
Copy link
Author

ghost commented Jan 4, 2015

Original comment by Anselm Kruis (Bitbucket: akruis, GitHub: akruis):


I just created pull request #14. It fixes the bug, but the fix is not elegant.
@ctismer and @krisvale : please have a look at the fix.

Once this issue is fixed, we can tag 2.7.9-slp.

@ghost
Copy link
Author

ghost commented Jan 7, 2015

Original comment by Kristján Valur Jónsson (Bitbucket: krisvale, GitHub: kristjanvalur):


I'm a bit busy at the moment with work, but will try to do this on the weekend.
:)

@ghost
Copy link
Author

ghost commented Jan 30, 2015

Original comment by Anselm Kruis (Bitbucket: akruis, GitHub: akruis):


I have some time to work on 2.7.9-slp. Unfortunately this patch has not been reviewed up to now.

I tested my patch on Windows 32bit and Linux 64bit. No problems so far.
I'm going to merge it now, because a clumsy patch, that fixes the bug is better than no patch at all.

@ghost
Copy link
Author

ghost commented Jan 30, 2015

Original comment by Christian Tismer (Bitbucket: ctismer, GitHub: ctismer):


On 30.01.15 15:58, Anselm Kruis wrote:

Hi Anselm,

sorry about this delay. I had a pretty bad phase last year, but I'm
working again, now.

@ghost
Copy link
Author

ghost commented Jan 30, 2015

Original comment by Christian Tismer (Bitbucket: ctismer, GitHub: ctismer):


I checked a fresh checkout of 2.7.9 on my Yosemite Mac and saw only some skipped tests, no errors:

#!python

$ make teststackless 2>&1 | grep skipped
testUnpickledProfileState (test_tstate.TestTracingState) ... skipped 'Not restorable'
OK (skipped=1)
test_bind_to_other_tid (test_thread.SchedulingBindThreadTests) ... skipped 'test requires softswitching'
test_crash (test_thread.TestRebindCrash) ... skipped 'test requires softswitching'
test_rebind (test_thread.TestRebindCrash) ... skipped 'test requires softswitching'
testUnpickledProfileState (test_tstate.TestTracingState) ... skipped 'Not restorable'
OK (skipped=4)
minimax:stackless tismer$

If that's ok with you, then I can confirm that the patch works on OSX, too.

@ghost
Copy link
Author

ghost commented Aug 21, 2016

Original comment by Anselm Kruis (Bitbucket: akruis, GitHub: akruis):


Stackless issue #80: fix an assertion failure during shutdown

This commit adds a test case to trigger an assertion failure during shutdown and
fixes the bug. The assertion was added by my first attempt to fix issue #60.
Thanks to Masamitsu Murase for reporting the bug and for providing the fix.

Edit: bitbucket attached this commit message to the wrong bug.

But the important lesson learned is: Just running the test suite isn't enough. It can't replace a careful code review.

@ghost
Copy link
Author

ghost commented Nov 6, 2016

Original comment by Anselm Kruis (Bitbucket: akruis, GitHub: akruis):


Removing milestone: 2.7.9-slp (automated comment)

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

0 participants