Skip to content
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

allow user to configure opt_handle_signals #333

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Some rules if you are writing multithreaded code:
- You probably also need to call `PythonCall.GC.disable()` on the main thread before any
threaded block of code. Remember to call `PythonCall.GC.enable()` again afterwards.
(This is because Julia finalizers can be called from any thread.)
- Julia intentionally causes segmentation faults as part of the GC safepoint mechanism.
If unhandled, these segfaults will result in termination of the process. To enable signal handling,
set `PYTHON_JULIACALL_HANDLE_SIGNALS=yes` before any calls to import juliacall. This is equivalent
to starting julia with `julia --handle-signals=yes`, the default behavior in Julia.
See discussion [here](https://github.com/cjdoris/PythonCall.jl/issues/219#issuecomment-1605087024) for more information.
- You may still encounter problems.

Related issues: [#201](https://github.com/cjdoris/PythonCall.jl/issues/201), [#202](https://github.com/cjdoris/PythonCall.jl/issues/202)
Expand Down
2 changes: 1 addition & 1 deletion pysrc/juliacall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def args_from_config():
CONFIG['opt_sysimage'] = sysimg = path_option('sysimage', check_exists=True)[0]
CONFIG['opt_threads'] = int_option('threads', accept_auto=True)[0]
CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0]
CONFIG['opt_handle_signals'] = 'no'
CONFIG['opt_handle_signals'] = choice('handle_signals', ['yes', 'no'], default='no')[0]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we default to yes? Defaulting to a behaviour which only causes crashes for backward compatibility doesn't seem very useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we default to yes? Defaulting to a behaviour which only causes crashes for backward compatibility doesn't seem very useful.

I agree, that's probably better to default to yes, but I left off for now as it is a behavioral change. Just posted a comment on this thread too, let's see what the author thinks


# Stop if we already initialised
if CONFIG['inited']:
Expand Down