-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Interop/UnmanagedCallersOnly fails on OSX. #38189
Comments
@sandreenko This seems to be an issue with a native thread created via The test is as follows: namespace
{
struct ProxyCallContext
{
CALLBACKPROC CallbackProc;
int N;
int Result;
};
void ProxyCall(ProxyCallContext* cxt)
{
cxt->Result = CallManagedProc(cxt->CallbackProc, cxt->N);
} // A/V is upon the exiting of the thread. The cxt is properly updated.
}
extern "C" DLL_EXPORT int STDMETHODCALLTYPE CallManagedProcOnNewThread(CALLBACKPROC pCallbackProc, int n)
{
ProxyCallContext cxt{ pCallbackProc, n, 0 };
std::thread newThreadToRuntime{ ProxyCall, &cxt };
// Wait for new thread to complete
newThreadToRuntime.join();
return cxt.Result;
} I think the new native thread entering the runtime is the issue here, but I don't know why as of yet. |
I honestly have no idea why this is failing, but is (a) recent and (b) doesn't happen when I use pthreads manually. Therefore I am going to use pthreads manually on non-Windows platforms. @janvorli If you are feeling bored and interested in picking at some weird behavior, this is something for you :) |
I finally found the issue. It is because during the Allocation:
Deallocation:
|
Does this mean that a 3rd party code that happens to use std::thread is going to hit the same problem? We are supposed to link the CoreCLR overridden operator new with private visibility, so that it is used just by the CoreCLR code and nothing else. Maybe this got broken again? |
Probably since the test doesn't link against anything special here.
Boo. That is unfortunate. Let me look into this some more then. If that is indeed the case it might make sense to leave this code as is since it is helpful finding that regression. |
See examples in https://dev.azure.com/dnceng/public/_build/results?buildId=697078&view=ms.vss-test-web.build-test-results-tab:
The text was updated successfully, but these errors were encountered: