-
Notifications
You must be signed in to change notification settings - Fork 373
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
Cleanup internal data-structures when process has been forked #2676
Changes from 4 commits
eb0444b
64e7e38
2c19556
679ab14
b7a564f
8acdfdc
55564c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ | |
import rerun as rr # pip install rerun-sdk | ||
|
||
|
||
# Python does not guarantee that the normal atexit-handlers will be called at the | ||
# termination of a multiprocessing.Process. Explicitly add the `shutdown_at_exit` | ||
# decorator to ensure data is flushed when the task completes. | ||
@rr.shutdown_at_exit | ||
def task(child_index: int) -> None: | ||
# All processes spawned with `multiprocessing` will automatically | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That comment (which predates the PR) doesn't make sense to me and I vote to remote it.
No they won't, that's why we need to call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They do have the same default recording-id... that's why calling init works instead of creating a new recording. But we still have to call init to create new sinks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh right I confused the |
||
# be assigned the same default recording_id. | ||
|
@@ -37,11 +41,6 @@ def main() -> None: | |
|
||
task(0) | ||
|
||
# Using multiprocessing with "fork" results in a hang on shutdown so | ||
# always use "spawn" | ||
# TODO(https://github.com/rerun-io/rerun/issues/1921) | ||
multiprocessing.set_start_method("spawn") | ||
|
||
for i in [1, 2, 3]: | ||
p = multiprocessing.Process(target=task, args=(i,)) | ||
p.start() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's worth clarifying here if we are detecting the fork as the parent or as the child, here and elsewhere