JuliaPy / JuliaPy/PyCall.jl

`Segmentation fault(core dumped)` when using multiple threads

Open
#1,078 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I first make multiple copies of a PyObject, and then access them in multiple threads. Finally, I meet this error.
`julia -t5`
```
using PyCall

py"""
class A():
x = 0.0
a = A()
"""

alist = [deepcopy(py"a") for i in 1:10]
# @show alist

for j in 1:100
Threads.@threads for i in 1:10
alist[i].x
end
end

```

Julia version
```
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, goldmont)

```
Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.