Bug 7229 – [GC] GC.collect fails when being called from Fiber

Status
NEW
Severity
normal
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2012-01-05T01:39:56Z
Last change time
2024-12-07T13:31:46Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#17239 →

Comments

Comment #0 by code — 2012-01-05T01:39:56Z
import core.memory, core.thread; void foo() { GC.collect(); } void main() { auto f = new Fiber(&foo); f.call(); } ---------- GetThreadContext in thread_suspendAll will fail. http://msdn.microsoft.com/en-us/library/windows/desktop/ms679362(v=vs.85).aspx states under remarks: "If you call GetThreadContext for the current thread, the function returns successfully; however, the context returned is not valid." Now it seems that the function can't handle calls from an unknown stack region (fiber stack) for the running thread. It does work for suspended threads though. We should simply use popad/asm to save the context. OS is Windows7.
Comment #1 by code — 2012-02-13T13:31:46Z
I can't reproduce the issue on Windows Server 2008 R2 – you are getting a "Unable to load thread context" exception? In any case, rewriting the code directly in assembler should be easy enough (and potentially faster), so I'll have a look at it.
Comment #2 by code — 2012-02-13T14:47:26Z
I get a 0 return value and an empty context but I don't remember the error code. Don't waste your time on this until I've rechecked it. There probably IS some issue with getting the context from suspended threads as well. Note: This is definitely no stack overflow issue.
Comment #3 by robert.schadek — 2024-12-07T13:31:46Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17239 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB