You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
KillerThread kills all threads that were created since the server's inception. This appears to be intended, but it shouldn't be. Dash should only modify threads that it has created.
Execute pytest -sv on the following example:
import dash
from dash import html
import threading
import time
def some_function_on_a_different_thread():
try:
print("starting long work")
time.sleep(5)
print("ending long work")
except SystemExit:
print("Thread received SystemExit.")
def test_some_function(dash_duo):
app = dash.Dash(__name__)
app.layout = html.Div(id="nully-wrapper", children=0)
dash_duo.start_server(app)
time.sleep(1)
# This function could interact with the webpage, or do some other important work
# in the background.
my_thread = threading.Thread(target=some_function_on_a_different_thread)
my_thread.start()
dash_duo.server.stop()
This is a rather contrived example, but I have pytest fixtures that spin up services that must last between tests, all of whom may or may not create their own threads throughout the session's lifetime.
Expected behavior
Test should hang for ~5 seconds, and then "ending long work" is printed.
Actual behavior
Test lasts ~1 second, and "Thread received SystemExit." is printed.
The text was updated successfully, but these errors were encountered:
gvwilson
changed the title
[BUG] dash_duo.server.stop() kills threads that it doesn't own - ones that were created after its inception
dash_duo.server.stop() kills threads that it doesn't own - ones that were created after its inception
Aug 13, 2024
Describe your context
Describe the bug
KillerThread kills all threads that were created since the server's inception. This appears to be intended, but it shouldn't be. Dash should only modify threads that it has created.
Execute
pytest -sv
on the following example:This is a rather contrived example, but I have pytest fixtures that spin up services that must last between tests, all of whom may or may not create their own threads throughout the session's lifetime.
Expected behavior
Test should hang for ~5 seconds, and then "ending long work" is printed.
Actual behavior
Test lasts ~1 second, and "Thread received SystemExit." is printed.
The text was updated successfully, but these errors were encountered: