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

Errors freeing memory atexit #279

Open
maleadt opened this issue Jan 24, 2025 · 1 comment
Open

Errors freeing memory atexit #279

maleadt opened this issue Jan 24, 2025 · 1 comment

Comments

@maleadt
Copy link
Member

maleadt commented Jan 24, 2025

At process exit, command queues and contexts are collected before allocations are, resulting in crashes:

      From worker 13:	[264837] signal 11 (1): Segmentation fault
      From worker 13:	in expression starting at none:0
      From worker 13:	clFinish at /home/tim/.julia/artifacts/c99d19d2f6dd75af3e997c4ecc4ac85e410cb7a7/lib/libOpenCL.so (unknown line)
      From worker 13:	macro expansion at /home/tim/Julia/pkg/OpenCL/lib/cl/libopencl.jl:703 [inlined]
      From worker 13:	#113 at /home/tim/Julia/pkg/OpenCL/lib/cl/api.jl:29 [inlined]
      From worker 13:	#1 at /home/tim/Julia/pkg/OpenCL/lib/cl/libopencl.jl:13 [inlined]
      From worker 13:	retry_reclaim at /home/tim/Julia/pkg/OpenCL/lib/cl/api.jl:49
      From worker 13:	check at /home/tim/Julia/pkg/OpenCL/lib/cl/libopencl.jl:10 [inlined]
      From worker 13:	clFinish at /home/tim/Julia/pkg/OpenCL/lib/cl/api.jl:34 [inlined]
      From worker 13:	finish at /home/tim/Julia/pkg/OpenCL/lib/cl/cmdqueue.jl:62 [inlined]
      From worker 13:	synchronize at /home/tim/Julia/pkg/OpenCL/src/memory.jl:29 [inlined]
      From worker 13:	#10 at /home/tim/Julia/pkg/OpenCL/src/memory.jl:149 [inlined]
      From worker 13:	device! at /home/tim/Julia/pkg/OpenCL/lib/cl/state.jl:152
      From worker 13:	free at /home/tim/Julia/pkg/OpenCL/src/memory.jl:143
      From worker 13:	unknown function (ip: 0x74d0d7939ab2)
      From worker 13:	release at /home/tim/.julia/packages/GPUArrays/Mot2g/src/host/abstractarray.jl:42
      From worker 13:	unsafe_free! at /home/tim/.julia/packages/GPUArrays/Mot2g/src/host/abstractarray.jl:100 [inlined]
      From worker 13:	unsafe_free! at /home/tim/.julia/packages/GPUArrays/Mot2g/src/host/abstractarray.jl:115
      From worker 13:	unknown function (ip: 0x74d0d79f6a92)
      From worker 13:	run_finalizer at /cache/build/builder-demeter6-3/julialang/julia-release-1-dot-11/src/gc.c:299
      From worker 13:	jl_gc_run_finalizers_in_list at /cache/build/builder-demeter6-3/julialang/julia-release-1-dot-11/src/gc.c:389
      From worker 13:	run_finalizers at /cache/build/builder-demeter6-3/julialang/julia-release-1-dot-11/src/gc.c:435
      From worker 13:	ijl_atexit_hook at /cache/build/builder-demeter6-3/julialang/julia-release-1-dot-11/src/init.c:299
@maleadt
Copy link
Member Author

maleadt commented Jan 24, 2025

Worked around in a17c34b, because most of the issues come from the queue getting freed before the buffer, but there's nothing preventing the context getting destroyed as well. Turns out OpenCL doesn't increment the refcount of the context when derived objects (such as buffers) are created, and I'm not sure if we're supposed to increment that refcount ourself, or use another mechanism.

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

1 participant