Fix crash on attaching external threads#2333
Fix crash on attaching external threads#2333dlang-bot merged 1 commit intodlang:stablefrom mihails-strasuns:fix-attach-collect
Conversation
|
Thanks for your pull request and interest in making D better, @mihails-strasuns! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "stable + druntime#2333" |
|
Also question: is there currently any testing infrastructure for mixing C/C++ and D code? I can't find one. |
It's being worked on. See Manu's various PRs, e.g. #2309 |
Do you need this for this PR? Should be possible to create a new thread with the Posix/Windows APIs to test this. |
|
It will be a bit different because of presence of On an unrelated note - how does one check report from buildkite? |
For now one needs to have an account which requires to be invited by an admin, like @wilzbach. |
|
The error is from testing Dub: The same error has occurred in other PRs so it's not related to this PR. |
|
@mihails-strasuns Try using this account to view the logs in Buildkite: |
Fixes https://issues.dlang.org/show_bug.cgi?id=19313 Issue comes from combination of two factors: 1) Calling `thread_attachThis` does `new Thread` as part of its implementation (because any thread context has to be wrapped into Thread class for registration in runtime). 2) Current GC implementation is not prepared to be called from external thread context and will crash in several places if `Thread.getThis` returns `null`. There are different possible fixes but it seems that the least intrusive one is to simply skip collection when called from the context of unregistered thread. Worst thing it can possibly do for any other code not affected by the issue is to delay garbage collection a bit.
|
Updated:
|
Part of https://issues.dlang.org/show_bug.cgi?id=19288
Issue comes from combination of two factors:
thread_attachThisdoesnew Threadas part of itsimplementation (because any thread context has to be wrapped into
Thread class for registration in runtime).
thread context and will crash in several places if
Thread.getThisreturns
null.There are different possible fixes but it seems that the least intrusive
one is to simply skip collection when called from the context of
unregistered thread. Worst thing it can possibly do for any other code
not affected by the issue is to delay garbage collection a bit.