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
The following code results in cysignals.signals.SignalError: Segmentation fault:
import multiprocessing
with multiprocessing.Pool() as pool:
for t in pool.imap_unordered( print, (d for d in range(1,100) if is_squarefree(d)) ):
pass
Expected Behavior
Segmentation fault should not happen.
Actual Behavior
The complete error message:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.10/multiprocessing/pool.py", line 535, in _handle_tasks
for task in taskseq:
File "/usr/lib/python3.10/multiprocessing/pool.py", line 391, in _guarded_task_generation
for i, x in enumerate(iterable):
File "/tmp/ipykernel_2667401/2212641732.py", line 4, in <genexpr>
File "/home/sc_serv/sage/src/sage/arith/misc.py", line 2993, in is_squarefree
return e.is_squarefree()
File "sage/rings/integer.pyx", line 6090, in sage.rings.integer.Integer.is_squarefree
File "sage/rings/integer.pyx", line 6182, in sage.rings.integer.Integer.__pari__
File "sage/libs/pari/convert_sage.pyx", line 377, in sage.libs.pari.convert_sage.new_gen_from_integer
File "sage/libs/pari/convert_sage.pyx", line 386, in sage.libs.pari.convert_sage.new_gen_from_integer
File "sage/libs/pari/convert_gmp.pyx", line 52, in sage.libs.pari.convert_gmp.new_gen_from_mpz_t
cysignals.signals.SignalError: Segmentation fault
Additional Information
Somehow the issue is related to the use of is_squarefree(). Replacing it with, say, is_prime() makes the code works fine.
The issue seems to be more widespread and not tied to is_squarefree(). I also see the following segmentation fault in different set-up when is_squarefree() is not used:
Exception in thread Thread-3 (_handle_results):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.10/multiprocessing/pool.py", line 579, in _handle_results
task = get()
File "/usr/lib/python3.10/multiprocessing/connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
File "cypari2/gen.pyx", line 4706, in cypari2.gen.objtogen
File "cypari2/gen.pyx", line 4813, in cypari2.gen.objtogen
File "cypari2/convert.pyx", line 556, in cypari2.convert.PyObject_AsGEN
cysignals.signals.SignalError: Segmentation fault
maxale
changed the title
cysignals.signals.SignalError: Segmentation fault when using is_squarefree() with multiprocessing
"cysignals.signals.SignalError: Segmentation fault" when using multiprocessing
Oct 1, 2023
Steps To Reproduce
The following code results in
cysignals.signals.SignalError: Segmentation fault
:Expected Behavior
Segmentation fault should not happen.
Actual Behavior
The complete error message:
Additional Information
Somehow the issue is related to the use of
is_squarefree()
. Replacing it with, say,is_prime()
makes the code works fine.Environment
Checklist
The text was updated successfully, but these errors were encountered: