Thanks to visit codestin.com
Credit goes to github.com

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

slp_kill_tasks_with_stacks is broken #81

Closed
ghost opened this issue Aug 22, 2016 · 2 comments
Closed

slp_kill_tasks_with_stacks is broken #81

ghost opened this issue Aug 22, 2016 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 22, 2016

Originally reported by: Anselm Kruis (Bitbucket: akruis, GitHub: akruis)


Problem

Since commit 2b9cd7d84dfd6e2 slp_kill_tasks_with_stacks pretends to send a kill message to tasklets on other threads. But the second loop is dead code, because it can't be reached.

Since commit 49d9f07ce726 slp_kill_tasks_with_stacks ignores its argument and operates on the current thread only.

During shutdown Py_Finalize() indirectly invokes slp_kill_tasks_with_stacks at least two times:

  1. with a NULL argument via PyStackless_kill_tasks_with_stacks(1). At this time, the interpreter is still fully functional.
  2. Once for each thread-state via PyInterpreterState_Clear(interp) and PyThreadState_Clear(). During these calls the import mechanism is no longer functional.

Because slp_kill_tasks_with_stacks ignores its argument, only the first call has any effect. Stackless dosn't kill any tasklets on other (daemon) threads.

Test Case

It's fairly hard to write a test case for problems, occurring late during interpreter shutdown. AFAIK the only option is to use a del-method of an object, that gets cleared sufficiently late. The codec search path, which is stored in the interpreter state, is such an object. PyInterpreterState_Clear clears it immediately after the threads.
My plan is to add a test-case, that ensures, that stackless kills all tasklets. Then I'll fix slp_kill_tasks_with_stacks.


@ghost
Copy link
Author

ghost commented Oct 20, 2016

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


I fixed slp_kill_tasks_with_stacks. See pull request #19 (merged) for a fix for 2.7-slp.

@ghost
Copy link
Author

ghost commented Nov 10, 2016

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


Fixed:

  • 2.7-slp: edc9b92ec457
  • 3.3-slp: 46754c1b351e, b8a8122bbb91
  • 3.4-slp: 5b02ca3b6bbe
  • default-slp: 812407045119

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