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 segmentation fault can be reproduced with the following code:
import concurrent.futures
import indigo
from indigo import renderer as indigo_renderer
SMILES_LIST = [
'C',
'CC',
'CCC',
'CCCCC',
'CCCCCC',
'CCCCCCC',
'CCCCCCCC',
]
def render(smiles):
ind = indigo.Indigo()
imol = ind.loadMolecule(smiles)
renderer = indigo_renderer.IndigoRenderer(ind)
ind.setOption('render-output-format', 'png')
buff = renderer.renderToBuffer(imol)
return buff.tobytes()
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
futures_dict = {
executor.submit(render, smiles): smiles
for smiles in SMILES_LIST
}
for future in concurrent.futures.as_completed(futures_dict):
smi = futures_dict[future]
try:
data = future.result()
except Exception as exc:
print(exc)
else:
print(data)
$ PYTHONFAULTHANDLER=1 python indigo_threading_test.py
Fatal Python error: Segmentation fault
Thread 0x00007fd2bbfff700 (most recent call first):
File "/home/f/virtualenvs/so2/lib/python3.8/site-packages/indigo/renderer.py", line 77 in renderToBuffer
File "indigo_threading_test.py", line 20 in render
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57 in run
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 80 in _worker
File "/usr/lib/python3.8/threading.py", line 870 in run
File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap
Current thread 0x00007fd2c0973700 (most recent call first):
File "/home/f/.virtualenvs/so2/lib/python3.8/site-packages/indigo/renderer.py", line 77 in renderToBuffer
File "indigo_threading_test.py", line 20 in render
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57 in run
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 80 in _worker
File "/usr/lib/python3.8/threading.py", line 870 in run
File "/usr/lib/python3.8/threading.py", line 932 in _bootstrap_inner
File "/usr/lib/python3.8/threading.py", line 890 in _bootstrap
Thread 0x00007fd2c275f740 (most recent call first):
File "/usr/lib/python3.8/threading.py", line 302 in wait
File "/usr/lib/python3.8/threading.py", line 558 in wait
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 244 in as_completed
File "indigo_threading_test.py", line 28 in <module>
Segmentation fault
No segfault if:
ThreadPoolExecutor.max_workers=1
indigo 1.4.3 is used
only Indigo is used and the IndigoRenderer is not used
The segfault still occurs if:
global Indigo and/or IndigoRenderer instance is used and not initialized inside the function
Dear @flc,
We have fixed the problem. I'll inform you when new version with fix appears in public repositories. I expect it to happen before the end of the week.
Hi,
The segmentation fault can be reproduced with the following code:
No segfault if:
The segfault still occurs if:
Python version:
Python 3.8.11
Indigo version:
1.5.0-g1aef03cac-x86_64-linux-gnu-9.3.1
The text was updated successfully, but these errors were encountered: