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

Tasks issues on Mac Catalyst #52460

Closed
directhex opened this issue May 7, 2021 · 4 comments · Fixed by #59587
Closed

Tasks issues on Mac Catalyst #52460

directhex opened this issue May 7, 2021 · 4 comments · Fixed by #59587
Assignees
Milestone

Comments

@directhex
Copy link
Member

directhex commented May 7, 2021

Description

* thread #11, name = 'com.apple.NSEventThread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2ee00)
    frame #0: 0x00007fff20243ed1 libsystem_malloc.dylib`tiny_malloc_from_free_list + 162
libsystem_malloc.dylib`tiny_malloc_from_free_list:
->  0x7fff20243ed1 <+162>: movq   %rax, (%r9)
    0x7fff20243ed4 <+165>: jmp    0x7fff20243f9d            ; <+366>
    0x7fff20243ed9 <+170>: movq   0x828(%r15), %rax
    0x7fff20243ee0 <+177>: shrq   %cl, %rax
Target 0: (System.Threading.Tasks.Tests) stopped.

Approx the same failure with System.Threading.Tasks.Dataflow.Tests

Configuration

./build.sh -ci -arch x64 -os MacCatalyst -s libs.tests -c Release /p:ArchiveTests=true /p:MonoForceInterpreter=true /p:CrossBuild=false

Regression?

No

Other information

Related PR: #51139

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label May 7, 2021
@steveisok
Copy link
Member

/cc @lambdageek

@marek-safar marek-safar removed the untriaged New issue has not been triaged by the area owner label May 7, 2021
@marek-safar marek-safar added this to the 6.0.0 milestone May 7, 2021
@steveisok steveisok modified the milestones: 6.0.0, 7.0.0 Aug 16, 2021
@lambdageek
Copy link
Member

Fails in various ways, but the upshot seems to be that a LowLevelLifoSemaphore (probably s_semaphore in PortableThreadPool.WorkerThread is not initialized when methods are called on it.

Sometimes we get a null sem_ptr in

gint32
ves_icall_System_Threading_LowLevelLifoSemaphore_TimedWaitInternal (gpointer sem_ptr, gint32 timeout_ms)

Sometimes instead the TimedWait throws a NRE, or sometimes there's an access violation.

It seems like PortableThreadPool.WorkerThread.WorkerThreadStart sees a null s_semaphore sometimes. Not clear how that can happen - or why it only happens on catalyst.

@lambdageek
Copy link
Member

This is failing because there are two tests disabled with [ActiveIssue("...", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))]

[ActiveIssue("https://github.com/dotnet/runtime/issues/38817", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))]

and

[ActiveIssue("https://github.com/dotnet/runtime/issues/38817", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))]

The problem is that GetIsRunningOnMonoInterpreter is wrong on mobile (including catalyst) - we don't set the MONO_ENV_OPTIONS variable to turn on the interpreter, we use the embedding API.

private static bool GetIsRunningOnMonoInterpreter()
{
#if NETCOREAPP
if (IsBrowser)
return RuntimeFeature.IsDynamicCodeSupported;
#endif
// This is a temporary solution because mono does not support interpreter detection
// within the runtime.
var val = Environment.GetEnvironmentVariable("MONO_ENV_OPTIONS");
return (val != null && val.Contains("--interpreter"));
}

So the fix is to do correct interpreter detection.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Sep 24, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Sep 25, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
@danmoseley
Copy link
Member

@lambdageek I happened to notice that this issue is closed but we are still excluding tests against it

<!-- Crashes randomly during test runs https://github.com/dotnet/runtime/issues/52460 -->

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants