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

ccall segfault on adopt_threads on win32 #47532

Closed
vtjnash opened this issue Nov 10, 2022 · 4 comments
Closed

ccall segfault on adopt_threads on win32 #47532

vtjnash opened this issue Nov 10, 2022 · 4 comments
Labels
ci Continuous integration ffi foreign function interfaces, ccall, etc. regression Regression in behavior compared to a previous version system:windows Affects only Windows

Comments

@vtjnash
Copy link
Member

vtjnash commented Nov 10, 2022

Been seeing this sometimes on CI lately. At first I assumed it was an OOM, but the backtrace doesn't really align well with that hypothesis, so this probably needs to be looked into more closely.

      From worker 9:
      From worker 9:	Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
      From worker 9:	Exception: EXCEPTION_ACCESS_VIOLATION at 0x746ed01d -- jl_makecontext at C:/workdir/src\win32_ucontext.c:61
      From worker 9:	in expression starting at C:\buildkite-agent\builds\win2k22-amdci6-2\julialang\julia-master\julia-1aa59a6e07\share\julia\test\ccall.jl:1066
      From worker 9:	jl_makecontext at C:/workdir/src\win32_ucontext.c:61
      From worker 9:	jl_init_root_task at C:/workdir/src\task.c:1559
      From worker 9:	ijl_adopt_thread at C:/workdir/src\threading.c:407
      From worker 9:	unknown function (ip: 3b4ce4af)
      From worker 9:	jl_work_wrapper at C:/workdir/src\jl_uv.c:987
      From worker 9:	uv__queue_work at /workspace/srcdir/libuv\src\threadpool.c:305
      From worker 9:	worker at /workspace/srcdir/libuv\src\threadpool.c:122
      From worker 9:	uv__thread_start at /workspace/srcdir/libuv\src/win\thread.c:111
      From worker 9:	beginthreadex at C:\Windows\System32\msvcrt.dll (unknown line)
      From worker 9:	endthreadex at C:\Windows\System32\msvcrt.dll (unknown line)
      From worker 9:	BaseThreadInitThunk at C:\Windows\System32\KERNEL32.DLL (unknown line)
      From worker 9:	RtlGetFullPathName_UEx at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
      From worker 9:	RtlGetFullPathName_UEx at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
      From worker 9:	Allocations: 406330629 (Pool: 406147582; Big: 183047); GC: 1166
Worker 9 terminated.

https://buildkite.com/julialang/julia-master/builds/18112#01845e6d-fc91-4a03-b508-5c3a2afbd063

@vtjnash vtjnash added regression Regression in behavior compared to a previous version system:windows Affects only Windows labels Nov 10, 2022
@DilumAluthge DilumAluthge added the ci Continuous integration label Nov 10, 2022
@vtjnash
Copy link
Member Author

vtjnash commented Nov 12, 2022

Looking closer, this is the first memory write that should be going to the newly allocated stack for the backup copy-stack context. It should be 0x20 bytes from the very end of it. It should be 8MB large. We have about 2GB allocated in this process already at this time.

That seems to align with being an OOM, but we should defer allocation of the first copy-stack for a new thread until we are actually forced to need it. Many foreign threads probably won't make new tasks that would need to use it.

@brenhinkeller brenhinkeller added the ffi foreign function interfaces, ccall, etc. label Nov 21, 2022
@giordano
Copy link
Contributor

giordano commented Jun 12, 2023

@vtjnash long shot, but since this involves threading can this possibly be fixed by #50135? Also #48907 reported an EXCEPTION_ACCESS_VIOLATION error, but I don't know if this test would involve libgomp at any point. If anything, this ticket was opened a week after #45582 was merged, so that'd match the "lately" part.

@vtjnash
Copy link
Member Author

vtjnash commented Jun 12, 2023

It had been ongoing for awhile before I opened this

@vtjnash
Copy link
Member Author

vtjnash commented Nov 6, 2023

Fixed by #49082

@vtjnash vtjnash closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration ffi foreign function interfaces, ccall, etc. regression Regression in behavior compared to a previous version system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

4 participants