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

GC crash when importing pygame & pyjulia #168

Closed
dpinol opened this issue May 9, 2022 · 3 comments
Closed

GC crash when importing pygame & pyjulia #168

dpinol opened this issue May 9, 2022 · 3 comments

Comments

@dpinol
Copy link
Contributor

dpinol commented May 9, 2022

Hi,
Julia crashes if pygame is imported after importing julia. The MWE that causes the crash is a python application which just loads pygame after JuliaCall (I get the same crash using pyjulia) and then allocates memory from a Julia thread. Swapping the 2 import lines avoids the issue

from juliacall import Main as jl
import pygame

jl.seval("""
function worker()
        for i in 1:10000000
            a = Float64[]
            push!(a, 0.42)
        end
    end
""")
jl.seval("t= Threads.@spawn worker()")
jl.eval("wait(t)")""")

Initially I created a Julia issue but I guess having the issue here is more useful.

@cjdoris
Copy link
Collaborator

cjdoris commented May 21, 2022

That's weird! Why would loading a module but not using it have that effect? Presumably there is some weird threads thing going on (is pygame multithreaded? I don't know what it is) but I don't know how to diagnose it.

PythonCall/JuliaCall in general doesn't support threads (because of Python's GIL) but I would have thought that using Julia's multithreading to do Julia-only things (i.e. not calling out to Python) would be OK.

Unfortunately I can't reproduce it. Does the same thing happen if you combine those 3 seval calls into one? Also I assume the eval should be seval in the MWE.

@cjdoris
Copy link
Collaborator

cjdoris commented Jul 2, 2022

Closing for lack of response. Feel free to reopen.

@cjdoris cjdoris closed this as completed Jul 2, 2022
@dpinol
Copy link
Contributor Author

dpinol commented Jul 18, 2022

Hi, since I had a workaround for this issue, I didn't find the time to follow it up.
I just created #202 for which I don't have a workaround :-( thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants