dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 508 forks source link

Implement PalHijack for Unix in PAL #642

Open janvorli opened 8 years ago

janvorli commented 8 years ago

Thread hijacking is necessary e.g. for GC stack walking.

christianscheuer commented 8 years ago

Hi @janvorli. Is there any progress on this, or would it be possible to work around the hijacking of threads? Right now a process on OSX/Unix will crash once the GC starts to suspend the threads, since it eventually calls PalHijack.

janvorli commented 8 years ago

@christianscheuer I am sorry for the late response, I had vacation for the last two weeks. I am glad @jkotas has provided a quick workaround for that. I have worked on implementing the hijacking in the past, but then I've realized that there are some other necessary changes that needed to be done first in order to make the hijacking work. Also, the GC was not working at that point, so there was no way to verify the change. But those prerequisities are now in, so I can finish the hijacking work.

christianscheuer commented 8 years ago

Hi @janvorli. Thank you for getting back to me, and yes the workaround definitely helps a lot. Looking forward to seeing how you will implement this, given the limitations of the Unix platform wrt. thread suspension.

kouvel commented 5 years ago

The first test case in https://github.com/dotnet/corert/issues/6780 seems to be deadlocking because of missing GC poll or asynchronous loop hijack mechanism. See https://github.com/dotnet/corert/issues/6780#issuecomment-454164252. I'll go ahead and resolve that issue with a fix for a different issue that was also reported there.