Bug 53955 - self_interrupt_thread: we can't resume from an async call assertion
Summary: self_interrupt_thread: we can't resume from an async call assertion
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-24 18:56 UTC by Zoltan Varga
Modified: 2017-10-06 22:40 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Zoltan Varga 2017-03-24 18:56:32 UTC
Testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
using System;
using System.Threading;

public class ThreadPoolTest
{

	static int csum = 0;
	
	public static void test_callback (object state) {
		ThreadPool.QueueUserWorkItem (new WaitCallback (test_callback), "TEST1");
	}

	public static int doit () {
		while (true) {
			ThreadPool.QueueUserWorkItem (new WaitCallback (test_callback), "TEST1");
		}
	}
	
	public static int Main () {
		var t = new Thread (delegate () { doit (); });
		t.IsBackground = true;
		t.Start ();
		Thread.Sleep (100);
		return 0;
	}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Run it using:
while true; do echo -n "."; ./mono bug.exe  || break; done

Actual result:

  thread #6: tid = 0x86e372, 0x9f8b7c4e libsystem_kernel.dylib`__wait4 + 10, name = 'Threadpool worker'
    frame #0: 0x9f8b7c4e libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x9f8362ff libsystem_c.dylib`waitpid$UNIX2003 + 32
    frame #2: 0x001e5713 mono`mono_handle_native_crash(signal="SIGABRT", ctx=0xb12266cc, info=0xb122668c) + 851 at mini-exceptions.c:2564
    frame #3: 0x002c3380 mono`sigabrt_signal_handler(_dummy=6, _info=0xb122668c, context=0xb12266cc) + 208 at mini-posix.c:208
    frame #4: 0x9f98eebb libsystem_platform.dylib`_sigtramp + 43
    frame #5: 0x9f8b749b libsystem_kernel.dylib`__pthread_kill + 11
    frame #6: 0x9f99aec3 libsystem_pthread.dylib`pthread_kill + 90
    frame #7: 0x9f817a44 libsystem_c.dylib`abort + 141
    frame #8: 0x00518b71 mono`mono_log_write_logfile(log_domain=0x00000000, level=G_LOG_LEVEL_ERROR, hdr=0, message="self_interrupt_thread: we can't resume from an async call") + 513 at mono-log-common.c:137
    frame #9: 0x0050fa9c mono`structured_log_adapter(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, message="self_interrupt_thread: we can't resume from an async call", user_data=0x00000000) + 76 at mono-logger.c:430
    frame #10: 0x0053ded6 mono`monoeg_g_logv(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format="%s: we can't resume from an async call", args="?YW") + 150 at goutput.c:115
    frame #11: 0x0053e01b mono`monoeg_g_log(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format="%s: we can't resume from an async call") + 59 at goutput.c:125
    frame #12: 0x003e1229 mono`self_interrupt_thread(_unused=0x00000000) + 121 at threads.c:4682
    frame #13: 0x00774149
    frame #14: 0x01cd8734 mscorlib.dll.dylib`System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool(executionContext=0x03775fb0, callback=0x00000001, state=0x0075a900, preserveSyncCtx=true) + 52 at executioncontext.cs:904
    frame #15: 0x01ce2ba0 mscorlib.dll.dylib`System_Threading_QueueUserWorkItemCallback_System_Threading_IThreadPoolWorkItem_ExecuteWorkItem(this=0x00c00478) + 96 at threadpool.cs:1283
    frame #16: 0x01ce139d mscorlib.dll.dylib`System_Threading_ThreadPoolWorkQueue_Dispatch + 461 at threadpool.cs:856
    frame #17: 0x01ce29c8 mscorlib.dll.dylib`System_Threading__ThreadPoolWaitCallback_PerformWaitCallback + 24
    frame #18: 0x00867d65
    frame #19: 0x000be187 mono`mono_jit_runtime_invoke(method=0x79bdd788, obj=0x00000000, params=0x00000000, exc=0xb1226d68, error=0xb1226da0) + 1415 at mini-runtime.c:2530
    frame #20: 0x00432241 mono`do_runtime_invoke(method=0x79bdd788, obj=0x00000000, params=0x00000000, exc=0xb1226d68, error=0xb1226da0) + 241 at object.c:2852
    frame #21: 0x0042cce3 mono`mono_runtime_try_invoke(method=0x79bdd788, obj=0x00000000, params=0x00000000, exc=0xb1226d68, error=0xb1226da0) + 259 at object.c:2963
    frame #22: 0x003e4c02 mono`try_invoke_perform_wait_callback(exc=0xb1226d68, error=0xb1226da0) + 130 at threadpool.c:274
    frame #23: 0x003e3d26 mono`worker_callback(unused=0x00000000) + 1558 at threadpool.c:356
    frame #24: 0x003e7a47 mono`worker_thread(unused=0x00000000) + 807 at threadpool-worker-default.c:543
    frame #25: 0x003dfe07 mono`start_wrapper_internal(start_info=0x00000000, stack_ptr=0xb1226f6c) + 535 at threads.c:824
    frame #26: 0x003dfa78 mono`start_wrapper(data=0x78f1ca80) + 152 at threads.c:886
    frame #27: 0x9f99810b libsystem_pthread.dylib`_pthread_body + 184
    frame #28: 0x9f998053 libsystem_pthread.dylib`_pthread_start + 243
    frame #29: 0x9f99790e libsystem_pthread.dylib`thread_start + 34
Comment 1 Ludovic Henry 2017-10-06 22:40:09 UTC
I cannot reproduce with Mono 5.8.0.2 (2017-10/a3943e28cf8)

Note You need to log in before you can comment on or make changes to this bug.