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

added rewritten NSUrlSessionHandler that handles memory better #31

Closed
wants to merge 5 commits into from
Closed

Conversation

nberardi
Copy link
Contributor

@nberardi nberardi commented May 4, 2016

With the original ModernHttpClient version of NSUrlSessionHandler it had 3 problems.

  1. The data in the request was loaded into memory using a byte array. code ref
  2. The data in the response was loaded into managed memory from unmanaged memory. And not properly disposed of. code ref
  3. The await response is returned before the stream is available, which is not how the .NET framework works. When the await response is returned in .NET the stream is available for reading. code ref

This pull request does the following the correct the above.

  1. Wraps a managed stream in an unmanaged stream and sends it to the request as a stream instead of byte array.
  2. Now directly uses NSData instead of transitioning to a managed byte array. And disposes of the NSData after fully read.
  3. The await response is now returned after the first piece of data is returned or the request is completed.

Please note this is a complete rewrite, which is why I didn't try to commit it to the ModernHttpClient repository. I am willing to move it some where else if it is more appropriate.

@dnfclas
Copy link

dnfclas commented May 4, 2016

Hi @nberardi, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.

TTYL, DNFBOT;

@dnfclas
Copy link

dnfclas commented May 4, 2016

@nberardi, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, DNFBOT;

@spouliot
Copy link
Contributor

spouliot commented May 5, 2016

Hello Nick, it was nice meeting you at Evolve and I wanted to email you about this :-)

There's a few things to solve, and might takes a few iterations, but your results were impressive in memory usage (lower and consistent) so this is something I'd like to move forward. I'll add some initial comments asap, thanks!

@@ -0,0 +1,716 @@
using System;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was based on the ModernHttpClient source code so it must retain it's copyright notice and your own should be added too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add them.

@spouliot
Copy link
Contributor

spouliot commented May 5, 2016

Beside the few initial comments (I did not test it locally yet) this will need to be updated to match our coding guideline (http://www.mono-project.com/community/contributing/coding-guidelines/) but that's fairly minor and can wait for further testing/comments. Thanks again!

@nberardi
Copy link
Contributor Author

nberardi commented May 5, 2016

I will work on the changes above and contribute. It might be a few days until I get to it, because I am in Disney World until Saturday. I had a down day today because, it was raining and we decided to stay at the hotel all day. :)

I also was able to solve the upload memory issue too, I didn't have a proof for you at the Evolve Conference, but I created a demo app to prove both upload and download to myself this afternoon.

I am still working on a further operation that I will commit as a different pull request. Because it further optimizes the use of NSData by not causing the memory to realign. However, this is a current problem with both ModernHttpClient and this version.

Because the NSData object is often pieced together from a number of different data objects, whenever possible, use NSData’s enumerateByteRangesUsingBlock: method to iterate through the data rather than using the bytes method (which flattens the NSData object into a single memory block).

This delegate method may be called more than once, and each call provides only data received since the previous call. The app is responsible for accumulating this data if needed. source link

@spouliot
Copy link
Contributor

spouliot commented May 5, 2016

Great, I'm looking forward to the updates :) Have a nice time at Disney World!

@nberardi
Copy link
Contributor Author

nberardi commented May 6, 2016

Made the changes recommended by @spouliot above. I will squash the changes into one commit after everything is signed off.

inflightRequests = new Dictionary<NSUrlSessionTask, InflightData> ();
}

protected override void Dispose (bool disposing)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks redundant, since it's just calling the base method. Can't this override just be removed?

Copy link
Contributor Author

@nberardi nberardi May 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you talking about Dispose? I think I forgot to implement the disposing of the inflight data. Thanks for the catch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm talking about the Dispose method.

@spouliot spouliot self-assigned this May 10, 2016
@nberardi
Copy link
Contributor Author

With the latest commit, I am able to wrap NSInputStream only using public methods.

@nberardi
Copy link
Contributor Author

Has there been any movement on getting this approved?

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request May 13, 2016
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fcntl.2.html

F_SETNOSIGPIPE

(lldb) bt all
  thread #1: tid = 0x1e176c9, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_a07', queue = 'com.apple.main-thread', stop reason = signal SIGPIPE
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x00425118 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7f0b5ac0, mutex=0x7f0b5a94, timeout_ms=15000) + 264 at mono-os-mutex.h:134
    frame #4: 0x00424e12 com.xamarin.systemtests.watchkitapp.watchkitextension`_wapi_handle_timedwait_signal_handle(handle=0x00000162, timeout=15000, alertable=1, poll=0, alerted=0xbff5c78c) + 802 at handles.c:1554
    frame #5: 0x00443387 com.xamarin.systemtests.watchkitapp.watchkitextension`wapi_WaitForSingleObjectEx(handle=0x00000162, timeout=15000, alertable=1) + 1127 at wait.c:173
    frame xamarin#6: 0x003a51a1 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_wait_uninterrupted(thread=0x12324120, multiple=0, numhandles=1, handles=0xbff5c874, waitall=0, ms=15000, alertable=1) + 225 at threads.c:1518
    frame xamarin#7: 0x003a55a2 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this_obj=0x115f65e0, handle=0x00000162, ms=15000, exitContext=0) + 162 at threads.c:1652
    frame xamarin#8: 0x137f06cc
    frame xamarin#9: 0x137f0594
    frame xamarin#10: 0x137f0382
    frame xamarin#11: 0x13e9053c
    frame xamarin#12: 0x13765e23
    frame xamarin#13: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 1349 at mini-runtime.c:2556
    frame xamarin#14: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 224 at object.c:2897
    frame xamarin#15: 0x0033bc75 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke_array(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 2293 at object.c:4437
    frame xamarin#16: 0x002b3f1b com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_InternalInvoke(method=0x1351cab0, this_arg=0x1159d670, params=0x00000000, exc=0xbff5cd68) + 2475 at icall.c:2804
    frame xamarin#17: 0x13766724
    frame xamarin#18: 0x13766560
    frame xamarin#19: 0x13766494
    frame xamarin#20: 0x137662c4
    frame xamarin#21: 0x13768af8
    frame xamarin#22: 0x13768394
    frame xamarin#23: 0x13768224
    frame xamarin#24: 0x13765f7f
    frame xamarin#25: 0x13765e93
    frame xamarin#26: 0x1375fcda
    frame xamarin#27: 0x1375f6dc
    frame xamarin#28: 0x137641cb
    frame xamarin#29: 0x13762458
    frame xamarin#30: 0x1375fcda
    frame xamarin#31: 0x1375f6dc
    frame xamarin#32: 0x137641cb
    frame xamarin#33: 0x13762458
    frame xamarin#34: 0x1375fcda
    frame xamarin#35: 0x1375f6dc
    frame xamarin#36: 0x137641cb
    frame xamarin#37: 0x13762458
    frame xamarin#38: 0x1375fcda
    frame xamarin#39: 0x1375f6dc
    frame xamarin#40: 0x1375e32d
    frame xamarin#41: 0x137285c0
    frame xamarin#42: 0x13728514
    frame xamarin#43: 0x137284a8
    frame xamarin#44: 0x12c4f7ef
    frame xamarin#45: 0x1298f833
    frame xamarin#46: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7c8b8440, obj=0x115ecb40, params=0xbff5d7ac, exc=0x00000000) + 1349 at mini-runtime.c:2556
    frame xamarin#47: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7c8b8440, obj=0x115ecb40, params=0xbff5d7ac, exc=0x00000000) + 224 at object.c:2897
    frame xamarin#48: 0x00494361 com.xamarin.systemtests.watchkitapp.watchkitextension`native_to_managed_trampoline_1(self=0x7d431130, _cmd="xamarinApplySelector", managed_method_ptr=0x00564d4c, r0="Foundation.NSAsyncActionDispatcher, Xamarin.WatchOS", r1="Apply") + 289 at Xamarin.WatchOS.registrar.watchos.m:40
    frame xamarin#49: 0x00494caa com.xamarin.systemtests.watchkitapp.watchkitextension`-[__MonoMac_NSAsyncActionDispatcher xamarinApplySelector](self=0x7d431130, _cmd="xamarinApplySelector") + 74 at Xamarin.WatchOS.registrar.watchos.m:1831
    frame xamarin#50: 0x045aa05d libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
    frame xamarin#51: 0x0076af17 Foundation`__NSThreadPerformPerform + 323
    frame xamarin#52: 0x0119828f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    frame xamarin#53: 0x0118df1b CoreFoundation`__CFRunLoopDoSources0 + 523
    frame xamarin#54: 0x0118d338 CoreFoundation`__CFRunLoopRun + 1032
    frame xamarin#55: 0x0118cc76 CoreFoundation`CFRunLoopRunSpecific + 470
    frame xamarin#56: 0x0118ca8b CoreFoundation`CFRunLoopRunInMode + 123
    frame xamarin#57: 0x0076f601 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
    frame xamarin#58: 0x008159cd Foundation`-[NSRunLoop(NSRunLoop) run] + 82
    frame xamarin#59: 0x053c30eb libxpc.dylib`_xpc_objc_main + 486
    frame xamarin#60: 0x053c5e4a libxpc.dylib`xpc_main + 215
    frame xamarin#61: 0x0093ec45 Foundation`-[NSXPCListener resume] + 186
    frame xamarin#62: 0x0d7f0326 PlugInKit`-[PKService run] + 582
    frame xamarin#63: 0x0178cc69 WatchKit`main + 146
    frame xamarin#64: 0x00493507 com.xamarin.systemtests.watchkitapp.watchkitextension`xamarin_main(argc=1, argv=0xbff5e954, is_extension=true) + 2599 at monotouch-main.m:461
    frame xamarin#65: 0x004a176c com.xamarin.systemtests.watchkitapp.watchkitextension`xamarin_watchextension_main(argc=1, argv=0xbff5e954) + 124 at main.i386.m:37
    frame xamarin#66: 0x050e3ae1 libdyld.dylib`start + 1

  thread #2: tid = 0x1e18197, 0x054347f6 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x054347f6 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x050ad2db libdispatch.dylib`_dispatch_mgr_invoke + 257
    frame #2: 0x050ad02b libdispatch.dylib`_dispatch_mgr_thread + 60

  thread #5: tid = 0x1e181a3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdcc0 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
    frame #3: 0x0041b3af com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_wait(cond=0x00564418, mutex=0x005643ec) + 47 at mono-os-mutex.h:105
    frame #4: 0x0041addd com.xamarin.systemtests.watchkitapp.watchkitextension`thread_func(thread_data=0x00000000) + 125 at sgen-thread-pool.c:118
    frame #5: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#6: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#7: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

* thread xamarin#6: tid = 0x1e181a4, 0x054353c6 libsystem_kernel.dylib`__write + 10, name = 'tid_2403'
    frame #0: 0x054353c6 libsystem_kernel.dylib`__write + 10
  * frame #1: 0x00398113 com.xamarin.systemtests.watchkitapp.watchkitextension`selector_thread_wakeup + 67 at threadpool-ms-io.c:149
    frame #2: 0x00398251 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_threadpool_ms_io_remove_socket(fd=20) + 113 at threadpool-ms-io.c:620
    frame #3: 0x0038f466 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Net_Sockets_Socket_Close_internal(sock=20, error=0xb0298b7c) + 38 at socket-io.c:692
    frame #4: 0x13745fc4
    frame #5: 0x13745df0
    frame xamarin#6: 0x13737795
    frame xamarin#7: 0x13745a8c
    frame xamarin#8: 0x13745a24
    frame xamarin#9: 0x137459e3
    frame xamarin#10: 0x137458f0
    frame xamarin#11: 0x13e33c0b
    frame xamarin#12: 0x13455c3c
    frame xamarin#13: 0x002a45e8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_gc_run_finalize(obj=0x1396cb60, data=0x00000000) + 1384 at gc.c:256
    frame xamarin#14: 0x00379fa4 com.xamarin.systemtests.watchkitapp.watchkitextension`sgen_client_run_finalize(obj=0x1396cb60) + 36 at sgen-mono.c:492
    frame xamarin#15: 0x003e121e com.xamarin.systemtests.watchkitapp.watchkitextension`sgen_gc_invoke_finalizers + 382 at sgen-gc.c:2455
    frame xamarin#16: 0x00379fbb com.xamarin.systemtests.watchkitapp.watchkitextension`mono_gc_invoke_finalizers + 11 at sgen-mono.c:498
    frame xamarin#17: 0x002a5f4a com.xamarin.systemtests.watchkitapp.watchkitextension`finalizer_thread(unused=0x00000000) + 442 at gc.c:739
    frame xamarin#18: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7bf07420) + 723 at threads.c:717
    frame xamarin#19: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7bf07420) + 34 at threads.c:764
    frame xamarin#20: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5e3e8) + 583 at mono-threads-posix.c:92
    frame xamarin#21: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#22: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#23: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#7: tid = 0x1e181b5, 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x053f952d libsystem_pthread.dylib`_pthread_wqthread + 1289
    frame #2: 0x053f6f72 libsystem_pthread.dylib`start_wqthread + 34

  thread xamarin#8: tid = 0x1e181b6, 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x053f952d libsystem_pthread.dylib`_pthread_wqthread + 1289
    frame #2: 0x053f6f72 libsystem_pthread.dylib`start_wqthread + 34

  thread xamarin#9: tid = 0x1e181d2, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_2f0f'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x00464538 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x00564b74, mutex=0x00564b48, timeout_ms=100) + 264 at mono-os-mutex.h:134
    frame #4: 0x004641ef com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x00564b74, mutex=0x00564b48, timeout_ms=100) + 63 at mono-coop-mutex.h:107
    frame #5: 0x00462dd5 com.xamarin.systemtests.watchkitapp.watchkitextension`sleep_interruptable(ms=100, alerted=0xb02bae2c) + 421 at mono-threads.c:1155
    frame xamarin#6: 0x00462a8b com.xamarin.systemtests.watchkitapp.watchkitextension`mono_thread_info_sleep(ms=100, alerted=0xb02bae2c) + 139 at mono-threads.c:1187
    frame xamarin#7: 0x003a0567 com.xamarin.systemtests.watchkitapp.watchkitextension`monitor_thread + 295 at threadpool-ms.c:887
    frame xamarin#8: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d33d9f0) + 723 at threads.c:717
    frame xamarin#9: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d33d9f0) + 34 at threads.c:764
    frame xamarin#10: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5d1a8) + 583 at mono-threads-posix.c:92
    frame xamarin#11: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#12: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#13: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#10: tid = 0x1e181d3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_300f'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=18478) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=18478) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7be244b0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7be244b0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5d148) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#11: tid = 0x1e181d6, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_370b'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=23036) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=23036) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d0222a0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d0222a0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0520738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#12: tid = 0x1e1828f, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_400f'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x00425118 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7f0b2eec, mutex=0x7f0b2ec0, timeout_ms=89999) + 264 at mono-os-mutex.h:134
    frame #4: 0x00424e12 com.xamarin.systemtests.watchkitapp.watchkitextension`_wapi_handle_timedwait_signal_handle(handle=0x0000010d, timeout=89999, alertable=1, poll=0, alerted=0xb072494c) + 802 at handles.c:1554
    frame #5: 0x00443387 com.xamarin.systemtests.watchkitapp.watchkitextension`wapi_WaitForSingleObjectEx(handle=0x0000010d, timeout=89999, alertable=1) + 1127 at wait.c:173
    frame xamarin#6: 0x003a51a1 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_wait_uninterrupted(thread=0x123266a0, multiple=0, numhandles=1, handles=0xb0724a34, waitall=0, ms=89999, alertable=1) + 225 at threads.c:1518
    frame xamarin#7: 0x003a55a2 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this_obj=0x115f1b00, handle=0x0000010d, ms=89999, exitContext=0) + 162 at threads.c:1652
    frame xamarin#8: 0x137f06cc
    frame xamarin#9: 0x137f0594
    frame xamarin#10: 0x137f0382
    frame xamarin#11: 0x1376c06e
    frame xamarin#12: 0x1376af7b
    frame xamarin#13: 0x1344d8b8
    frame xamarin#14: 0x1344d36c
    frame xamarin#15: 0x1376a9d0
    frame xamarin#16: 0x1376a8f8
    frame xamarin#17: 0x1376a883
    frame xamarin#18: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7f18c1f0, obj=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 1349 at mini-runtime.c:2556
    frame xamarin#19: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7f18c1f0, obj=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 224 at object.c:2897
    frame xamarin#20: 0x00339b7f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_delegate_invoke(delegate=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 175 at object.c:3657
    frame xamarin#21: 0x003ab807 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d26a5f0) + 855 at threads.c:723
    frame xamarin#22: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d26a5f0) + 34 at threads.c:764
    frame xamarin#23: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5b248) + 583 at mono-threads-posix.c:92
    frame xamarin#24: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#25: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#26: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#13: tid = 0x1e190a8, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_5593'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=59668) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=59668) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d36b470) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d36b470) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0622738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#14: tid = 0x1e19492, 0x0543373e libsystem_kernel.dylib`__select + 10, name = 'tid_1c07'
    frame #0: 0x0543373e libsystem_kernel.dylib`__select + 10
    frame #1: 0x00458e30 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_poll(ufds=<unavailable>, nfds=14, timeout=<unavailable>) + 416 at mono-poll.c:83
    frame #2: 0x00399788 com.xamarin.systemtests.watchkitapp.watchkitextension`poll_event_wait(callback=(com.xamarin.systemtests.watchkitapp.watchkitextension`wait_callback at threadpool-ms-io.c:247), user_data=0x7d27edd0) + 152 at threadpool-ms-io-poll.c:152
    frame #3: 0x00398eb8 com.xamarin.systemtests.watchkitapp.watchkitextension`selector_thread(data=0x00000000) + 2104 at threadpool-ms-io.c:413
    frame #4: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d27f390) + 723 at threads.c:717
    frame #5: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d27f390) + 34 at threads.c:764
    frame xamarin#6: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5c4a8) + 583 at mono-threads-posix.c:92
    frame xamarin#7: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#8: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#9: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#15: tid = 0x1e1949d, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_42cf'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=25061) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=25061) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d2783b0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d2783b0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0826738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#16: tid = 0x1e194a2, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4337'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=58904) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=58904) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d2792b0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d2792b0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb00b4648) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#17: tid = 0x1e194a3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_5d0b'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=44800) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=44800) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d279930) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d279930) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0520738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#18: tid = 0x1e194a4, 0x0044a69d com.xamarin.systemtests.watchkitapp.watchkitextension`get_hazardous_pointer(pp=0x7be4324c, hp=0x11536384, hazard_index=1) + 381 at hazard-pointer.c:215, name = 'tid_4fa3'
    frame #0: 0x0044a69d com.xamarin.systemtests.watchkitapp.watchkitextension`get_hazardous_pointer(pp=0x7be4324c, hp=0x11536384, hazard_index=1) + 381 at hazard-pointer.c:215
    frame #1: 0x002c6752 com.xamarin.systemtests.watchkitapp.watchkitextension`jit_info_table_chunk_index(chunk=0x7be43200, hp=0x11536384, addr=0x13761be0) + 130 at jit-info.c:200
    frame #2: 0x002c54b2 com.xamarin.systemtests.watchkitapp.watchkitextension`jit_info_table_find(table=0x7f29de00, hp=0x11536384, addr=0x13761be0) + 178 at jit-info.c:222
    frame #3: 0x002c5255 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_info_table_find_internal(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                                 P?O???D$\x04\x93\x88", try_aot=1, allow_trampolines=1) + 133 at jit-info.c:293
    frame #4: 0x001bacf6 com.xamarin.systemtests.watchkitapp.watchkitextension`mini_jit_info_table_find_ext(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                            P?O???D$\x04\x93\x88", allow_trampolines=1, out_domain=0x00000000) + 102 at mini-exceptions.c:1020
    frame #5: 0x001b95d2 com.xamarin.systemtests.watchkitapp.watchkitextension`mini_jit_info_table_find(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                        P?O???D$\x04\x93\x88", out_domain=0x00000000) + 66 at mini-exceptions.c:1058
    frame xamarin#6: 0x001d9b3b com.xamarin.systemtests.watchkitapp.watchkitextension`common_call_trampoline_inner(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                          P?O???D$\x04\x93\x88", m=0x7f17d830, vt=0x00000000, vtable_slot=0x00000000) + 5147 at mini-trampolines.c:784
    frame xamarin#7: 0x001d5e1b com.xamarin.systemtests.watchkitapp.watchkitextension`common_call_trampoline(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                    P?O???D$\x04\x93\x88", m=0x7f17d830, vt=0x00000000, vtable_slot=0x00000000) + 91 at mini-trampolines.c:808
    frame xamarin#8: 0x001d5db7 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_magic_trampoline(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                   P?O???D$\x04\x93\x88", arg=0x7f17d830, tramp=0x00000000) + 103 at mini-trampolines.c:823
    frame xamarin#9: 0x11526188

  thread xamarin#19: tid = 0x1e194a5, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4717'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=22144) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=22144) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d369d60) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d369d60) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0a2a738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34
@spouliot
Copy link
Contributor

Consider it dev approved, i.e. everything looks good, there's no further comments. However it's a large (impact) change and most of our networking tests are done by QA (not on our development bots).

I'll have QA test a branch with your changes before merging into master (standard policy for any large change). The exact dates depends on QA availability (currently focusing on getting C7 to stable).

Can you rebase/squash your changes so I can a bot to build a package based on the PR ? thanks!

@nberardi
Copy link
Contributor Author

@spouliot everything was squashed and rebased against the latest commits upstream. No problem on the timing, if anything comes up let me know, I will be happy to work through the issues.

@spouliot
Copy link
Contributor

Thanks! We now have a lane that will produce the package fro QA and I'll chat with them on Monday about testing this. Have a nice weekend!

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request May 16, 2016
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/fcntl.2.html

F_SETNOSIGPIPE

(lldb) bt all
  thread #1: tid = 0x1e176c9, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_a07', queue = 'com.apple.main-thread', stop reason = signal SIGPIPE
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x00425118 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7f0b5ac0, mutex=0x7f0b5a94, timeout_ms=15000) + 264 at mono-os-mutex.h:134
    frame #4: 0x00424e12 com.xamarin.systemtests.watchkitapp.watchkitextension`_wapi_handle_timedwait_signal_handle(handle=0x00000162, timeout=15000, alertable=1, poll=0, alerted=0xbff5c78c) + 802 at handles.c:1554
    frame #5: 0x00443387 com.xamarin.systemtests.watchkitapp.watchkitextension`wapi_WaitForSingleObjectEx(handle=0x00000162, timeout=15000, alertable=1) + 1127 at wait.c:173
    frame xamarin#6: 0x003a51a1 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_wait_uninterrupted(thread=0x12324120, multiple=0, numhandles=1, handles=0xbff5c874, waitall=0, ms=15000, alertable=1) + 225 at threads.c:1518
    frame xamarin#7: 0x003a55a2 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this_obj=0x115f65e0, handle=0x00000162, ms=15000, exitContext=0) + 162 at threads.c:1652
    frame xamarin#8: 0x137f06cc
    frame xamarin#9: 0x137f0594
    frame xamarin#10: 0x137f0382
    frame xamarin#11: 0x13e9053c
    frame xamarin#12: 0x13765e23
    frame xamarin#13: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 1349 at mini-runtime.c:2556
    frame xamarin#14: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 224 at object.c:2897
    frame xamarin#15: 0x0033bc75 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke_array(method=0x7c8c8950, obj=0x1159d670, params=0x00000000, exc=0x00000000) + 2293 at object.c:4437
    frame xamarin#16: 0x002b3f1b com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_InternalInvoke(method=0x1351cab0, this_arg=0x1159d670, params=0x00000000, exc=0xbff5cd68) + 2475 at icall.c:2804
    frame xamarin#17: 0x13766724
    frame xamarin#18: 0x13766560
    frame xamarin#19: 0x13766494
    frame xamarin#20: 0x137662c4
    frame xamarin#21: 0x13768af8
    frame xamarin#22: 0x13768394
    frame xamarin#23: 0x13768224
    frame xamarin#24: 0x13765f7f
    frame xamarin#25: 0x13765e93
    frame xamarin#26: 0x1375fcda
    frame xamarin#27: 0x1375f6dc
    frame xamarin#28: 0x137641cb
    frame xamarin#29: 0x13762458
    frame xamarin#30: 0x1375fcda
    frame xamarin#31: 0x1375f6dc
    frame xamarin#32: 0x137641cb
    frame xamarin#33: 0x13762458
    frame xamarin#34: 0x1375fcda
    frame xamarin#35: 0x1375f6dc
    frame xamarin#36: 0x137641cb
    frame xamarin#37: 0x13762458
    frame xamarin#38: 0x1375fcda
    frame xamarin#39: 0x1375f6dc
    frame xamarin#40: 0x1375e32d
    frame xamarin#41: 0x137285c0
    frame xamarin#42: 0x13728514
    frame xamarin#43: 0x137284a8
    frame xamarin#44: 0x12c4f7ef
    frame xamarin#45: 0x1298f833
    frame xamarin#46: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7c8b8440, obj=0x115ecb40, params=0xbff5d7ac, exc=0x00000000) + 1349 at mini-runtime.c:2556
    frame xamarin#47: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7c8b8440, obj=0x115ecb40, params=0xbff5d7ac, exc=0x00000000) + 224 at object.c:2897
    frame xamarin#48: 0x00494361 com.xamarin.systemtests.watchkitapp.watchkitextension`native_to_managed_trampoline_1(self=0x7d431130, _cmd="xamarinApplySelector", managed_method_ptr=0x00564d4c, r0="Foundation.NSAsyncActionDispatcher, Xamarin.WatchOS", r1="Apply") + 289 at Xamarin.WatchOS.registrar.watchos.m:40
    frame xamarin#49: 0x00494caa com.xamarin.systemtests.watchkitapp.watchkitextension`-[__MonoMac_NSAsyncActionDispatcher xamarinApplySelector](self=0x7d431130, _cmd="xamarinApplySelector") + 74 at Xamarin.WatchOS.registrar.watchos.m:1831
    frame xamarin#50: 0x045aa05d libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
    frame xamarin#51: 0x0076af17 Foundation`__NSThreadPerformPerform + 323
    frame xamarin#52: 0x0119828f CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    frame xamarin#53: 0x0118df1b CoreFoundation`__CFRunLoopDoSources0 + 523
    frame xamarin#54: 0x0118d338 CoreFoundation`__CFRunLoopRun + 1032
    frame xamarin#55: 0x0118cc76 CoreFoundation`CFRunLoopRunSpecific + 470
    frame xamarin#56: 0x0118ca8b CoreFoundation`CFRunLoopRunInMode + 123
    frame xamarin#57: 0x0076f601 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
    frame xamarin#58: 0x008159cd Foundation`-[NSRunLoop(NSRunLoop) run] + 82
    frame xamarin#59: 0x053c30eb libxpc.dylib`_xpc_objc_main + 486
    frame xamarin#60: 0x053c5e4a libxpc.dylib`xpc_main + 215
    frame xamarin#61: 0x0093ec45 Foundation`-[NSXPCListener resume] + 186
    frame xamarin#62: 0x0d7f0326 PlugInKit`-[PKService run] + 582
    frame xamarin#63: 0x0178cc69 WatchKit`main + 146
    frame xamarin#64: 0x00493507 com.xamarin.systemtests.watchkitapp.watchkitextension`xamarin_main(argc=1, argv=0xbff5e954, is_extension=true) + 2599 at monotouch-main.m:461
    frame xamarin#65: 0x004a176c com.xamarin.systemtests.watchkitapp.watchkitextension`xamarin_watchextension_main(argc=1, argv=0xbff5e954) + 124 at main.i386.m:37
    frame xamarin#66: 0x050e3ae1 libdyld.dylib`start + 1

  thread #2: tid = 0x1e18197, 0x054347f6 libsystem_kernel.dylib`kevent64 + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x054347f6 libsystem_kernel.dylib`kevent64 + 10
    frame #1: 0x050ad2db libdispatch.dylib`_dispatch_mgr_invoke + 257
    frame #2: 0x050ad02b libdispatch.dylib`_dispatch_mgr_thread + 60

  thread #5: tid = 0x1e181a3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdcc0 libsystem_pthread.dylib`pthread_cond_wait$UNIX2003 + 71
    frame #3: 0x0041b3af com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_wait(cond=0x00564418, mutex=0x005643ec) + 47 at mono-os-mutex.h:105
    frame #4: 0x0041addd com.xamarin.systemtests.watchkitapp.watchkitextension`thread_func(thread_data=0x00000000) + 125 at sgen-thread-pool.c:118
    frame #5: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#6: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#7: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

* thread xamarin#6: tid = 0x1e181a4, 0x054353c6 libsystem_kernel.dylib`__write + 10, name = 'tid_2403'
    frame #0: 0x054353c6 libsystem_kernel.dylib`__write + 10
  * frame #1: 0x00398113 com.xamarin.systemtests.watchkitapp.watchkitextension`selector_thread_wakeup + 67 at threadpool-ms-io.c:149
    frame #2: 0x00398251 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_threadpool_ms_io_remove_socket(fd=20) + 113 at threadpool-ms-io.c:620
    frame #3: 0x0038f466 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Net_Sockets_Socket_Close_internal(sock=20, error=0xb0298b7c) + 38 at socket-io.c:692
    frame #4: 0x13745fc4
    frame #5: 0x13745df0
    frame xamarin#6: 0x13737795
    frame xamarin#7: 0x13745a8c
    frame xamarin#8: 0x13745a24
    frame xamarin#9: 0x137459e3
    frame xamarin#10: 0x137458f0
    frame xamarin#11: 0x13e33c0b
    frame xamarin#12: 0x13455c3c
    frame xamarin#13: 0x002a45e8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_gc_run_finalize(obj=0x1396cb60, data=0x00000000) + 1384 at gc.c:256
    frame xamarin#14: 0x00379fa4 com.xamarin.systemtests.watchkitapp.watchkitextension`sgen_client_run_finalize(obj=0x1396cb60) + 36 at sgen-mono.c:492
    frame xamarin#15: 0x003e121e com.xamarin.systemtests.watchkitapp.watchkitextension`sgen_gc_invoke_finalizers + 382 at sgen-gc.c:2455
    frame xamarin#16: 0x00379fbb com.xamarin.systemtests.watchkitapp.watchkitextension`mono_gc_invoke_finalizers + 11 at sgen-mono.c:498
    frame xamarin#17: 0x002a5f4a com.xamarin.systemtests.watchkitapp.watchkitextension`finalizer_thread(unused=0x00000000) + 442 at gc.c:739
    frame xamarin#18: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7bf07420) + 723 at threads.c:717
    frame xamarin#19: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7bf07420) + 34 at threads.c:764
    frame xamarin#20: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5e3e8) + 583 at mono-threads-posix.c:92
    frame xamarin#21: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#22: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#23: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#7: tid = 0x1e181b5, 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x053f952d libsystem_pthread.dylib`_pthread_wqthread + 1289
    frame #2: 0x053f6f72 libsystem_pthread.dylib`start_wqthread + 34

  thread xamarin#8: tid = 0x1e181b6, 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x05433d76 libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x053f952d libsystem_pthread.dylib`_pthread_wqthread + 1289
    frame #2: 0x053f6f72 libsystem_pthread.dylib`start_wqthread + 34

  thread xamarin#9: tid = 0x1e181d2, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_2f0f'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x00464538 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x00564b74, mutex=0x00564b48, timeout_ms=100) + 264 at mono-os-mutex.h:134
    frame #4: 0x004641ef com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x00564b74, mutex=0x00564b48, timeout_ms=100) + 63 at mono-coop-mutex.h:107
    frame #5: 0x00462dd5 com.xamarin.systemtests.watchkitapp.watchkitextension`sleep_interruptable(ms=100, alerted=0xb02bae2c) + 421 at mono-threads.c:1155
    frame xamarin#6: 0x00462a8b com.xamarin.systemtests.watchkitapp.watchkitextension`mono_thread_info_sleep(ms=100, alerted=0xb02bae2c) + 139 at mono-threads.c:1187
    frame xamarin#7: 0x003a0567 com.xamarin.systemtests.watchkitapp.watchkitextension`monitor_thread + 295 at threadpool-ms.c:887
    frame xamarin#8: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d33d9f0) + 723 at threads.c:717
    frame xamarin#9: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d33d9f0) + 34 at threads.c:764
    frame xamarin#10: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5d1a8) + 583 at mono-threads-posix.c:92
    frame xamarin#11: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#12: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#13: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#10: tid = 0x1e181d3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_300f'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=18478) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=18478) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7be244b0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7be244b0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5d148) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#11: tid = 0x1e181d6, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_370b'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=23036) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=23036) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d0222a0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d0222a0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0520738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#12: tid = 0x1e1828f, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_400f'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x00425118 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7f0b2eec, mutex=0x7f0b2ec0, timeout_ms=89999) + 264 at mono-os-mutex.h:134
    frame #4: 0x00424e12 com.xamarin.systemtests.watchkitapp.watchkitextension`_wapi_handle_timedwait_signal_handle(handle=0x0000010d, timeout=89999, alertable=1, poll=0, alerted=0xb072494c) + 802 at handles.c:1554
    frame #5: 0x00443387 com.xamarin.systemtests.watchkitapp.watchkitextension`wapi_WaitForSingleObjectEx(handle=0x0000010d, timeout=89999, alertable=1) + 1127 at wait.c:173
    frame xamarin#6: 0x003a51a1 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_wait_uninterrupted(thread=0x123266a0, multiple=0, numhandles=1, handles=0xb0724a34, waitall=0, ms=89999, alertable=1) + 225 at threads.c:1518
    frame xamarin#7: 0x003a55a2 com.xamarin.systemtests.watchkitapp.watchkitextension`ves_icall_System_Threading_WaitHandle_WaitOne_internal(this_obj=0x115f1b00, handle=0x0000010d, ms=89999, exitContext=0) + 162 at threads.c:1652
    frame xamarin#8: 0x137f06cc
    frame xamarin#9: 0x137f0594
    frame xamarin#10: 0x137f0382
    frame xamarin#11: 0x1376c06e
    frame xamarin#12: 0x1376af7b
    frame xamarin#13: 0x1344d8b8
    frame xamarin#14: 0x1344d36c
    frame xamarin#15: 0x1376a9d0
    frame xamarin#16: 0x1376a8f8
    frame xamarin#17: 0x1376a883
    frame xamarin#18: 0x001d1365 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_runtime_invoke(method=0x7f18c1f0, obj=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 1349 at mini-runtime.c:2556
    frame xamarin#19: 0x003327d0 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_invoke(method=0x7f18c1f0, obj=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 224 at object.c:2897
    frame xamarin#20: 0x00339b7f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_runtime_delegate_invoke(delegate=0x115f1c70, params=0xb0724ec0, exc=0x00000000) + 175 at object.c:3657
    frame xamarin#21: 0x003ab807 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d26a5f0) + 855 at threads.c:723
    frame xamarin#22: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d26a5f0) + 34 at threads.c:764
    frame xamarin#23: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5b248) + 583 at mono-threads-posix.c:92
    frame xamarin#24: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#25: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#26: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#13: tid = 0x1e190a8, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_5593'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=59668) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=59668) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d36b470) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d36b470) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0622738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#14: tid = 0x1e19492, 0x0543373e libsystem_kernel.dylib`__select + 10, name = 'tid_1c07'
    frame #0: 0x0543373e libsystem_kernel.dylib`__select + 10
    frame #1: 0x00458e30 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_poll(ufds=<unavailable>, nfds=14, timeout=<unavailable>) + 416 at mono-poll.c:83
    frame #2: 0x00399788 com.xamarin.systemtests.watchkitapp.watchkitextension`poll_event_wait(callback=(com.xamarin.systemtests.watchkitapp.watchkitextension`wait_callback at threadpool-ms-io.c:247), user_data=0x7d27edd0) + 152 at threadpool-ms-io-poll.c:152
    frame #3: 0x00398eb8 com.xamarin.systemtests.watchkitapp.watchkitextension`selector_thread(data=0x00000000) + 2104 at threadpool-ms-io.c:413
    frame #4: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d27f390) + 723 at threads.c:717
    frame #5: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d27f390) + 34 at threads.c:764
    frame xamarin#6: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xbff5c4a8) + 583 at mono-threads-posix.c:92
    frame xamarin#7: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#8: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#9: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#15: tid = 0x1e1949d, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_42cf'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=25061) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=25061) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d2783b0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d2783b0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0826738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#16: tid = 0x1e194a2, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4337'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=58904) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=58904) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d2792b0) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d2792b0) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb00b4648) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#17: tid = 0x1e194a3, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_5d0b'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=44800) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=44800) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d279930) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d279930) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0520738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34

  thread xamarin#18: tid = 0x1e194a4, 0x0044a69d com.xamarin.systemtests.watchkitapp.watchkitextension`get_hazardous_pointer(pp=0x7be4324c, hp=0x11536384, hazard_index=1) + 381 at hazard-pointer.c:215, name = 'tid_4fa3'
    frame #0: 0x0044a69d com.xamarin.systemtests.watchkitapp.watchkitextension`get_hazardous_pointer(pp=0x7be4324c, hp=0x11536384, hazard_index=1) + 381 at hazard-pointer.c:215
    frame #1: 0x002c6752 com.xamarin.systemtests.watchkitapp.watchkitextension`jit_info_table_chunk_index(chunk=0x7be43200, hp=0x11536384, addr=0x13761be0) + 130 at jit-info.c:200
    frame #2: 0x002c54b2 com.xamarin.systemtests.watchkitapp.watchkitextension`jit_info_table_find(table=0x7f29de00, hp=0x11536384, addr=0x13761be0) + 178 at jit-info.c:222
    frame #3: 0x002c5255 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_jit_info_table_find_internal(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                                 P?O???D$\x04\x93\x88", try_aot=1, allow_trampolines=1) + 133 at jit-info.c:293
    frame #4: 0x001bacf6 com.xamarin.systemtests.watchkitapp.watchkitextension`mini_jit_info_table_find_ext(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                            P?O???D$\x04\x93\x88", allow_trampolines=1, out_domain=0x00000000) + 102 at mini-exceptions.c:1020
    frame #5: 0x001b95d2 com.xamarin.systemtests.watchkitapp.watchkitextension`mini_jit_info_table_find(domain=0x7be07e70, addr="\x8bE??
                                                                                                                                        P?O???D$\x04\x93\x88", out_domain=0x00000000) + 66 at mini-exceptions.c:1058
    frame xamarin#6: 0x001d9b3b com.xamarin.systemtests.watchkitapp.watchkitextension`common_call_trampoline_inner(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                          P?O???D$\x04\x93\x88", m=0x7f17d830, vt=0x00000000, vtable_slot=0x00000000) + 5147 at mini-trampolines.c:784
    frame xamarin#7: 0x001d5e1b com.xamarin.systemtests.watchkitapp.watchkitextension`common_call_trampoline(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                    P?O???D$\x04\x93\x88", m=0x7f17d830, vt=0x00000000, vtable_slot=0x00000000) + 91 at mini-trampolines.c:808
    frame xamarin#8: 0x001d5db7 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_magic_trampoline(regs=0xb0c2e860, code="\x8bE??
                                                                                                                                   P?O???D$\x04\x93\x88", arg=0x7f17d830, tramp=0x00000000) + 103 at mini-trampolines.c:823
    frame xamarin#9: 0x11526188

  thread xamarin#19: tid = 0x1e194a5, 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_4717'
    frame #0: 0x05433402 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x053f9f6b libsystem_pthread.dylib`_pthread_cond_wait + 757
    frame #2: 0x053fdd0c libsystem_pthread.dylib`pthread_cond_timedwait$UNIX2003 + 71
    frame #3: 0x003a25b8 com.xamarin.systemtests.watchkitapp.watchkitextension`mono_os_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=22144) + 264 at mono-os-mutex.h:134
    frame #4: 0x003a248f com.xamarin.systemtests.watchkitapp.watchkitextension`mono_coop_cond_timedwait(cond=0x7d33d150, mutex=0x7d33d16c, timeout_ms=22144) + 63 at mono-coop-mutex.h:107
    frame #5: 0x003a2260 com.xamarin.systemtests.watchkitapp.watchkitextension`worker_park + 576 at threadpool-ms.c:525
    frame xamarin#6: 0x003a14af com.xamarin.systemtests.watchkitapp.watchkitextension`worker_thread(data=0x00000000) + 1199 at threadpool-ms.c:615
    frame xamarin#7: 0x003ab783 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper_internal(data=0x7d369d60) + 723 at threads.c:717
    frame xamarin#8: 0x003ab4a2 com.xamarin.systemtests.watchkitapp.watchkitextension`start_wrapper(data=0x7d369d60) + 34 at threads.c:764
    frame xamarin#9: 0x0045d477 com.xamarin.systemtests.watchkitapp.watchkitextension`inner_start_thread(arg=0xb0a2a738) + 583 at mono-threads-posix.c:92
    frame xamarin#10: 0x053f9a26 libsystem_pthread.dylib`_pthread_body + 138
    frame xamarin#11: 0x053f999c libsystem_pthread.dylib`_pthread_start + 155
    frame xamarin#12: 0x053f6f96 libsystem_pthread.dylib`thread_start + 34
@spouliot
Copy link
Contributor

@spouliot
Copy link
Contributor

The QA tests failed. While the old files (from ModernHttpClient) were removed from the build it looks like the new NSUrlSessionHandler.cs was not added.

As such the bots built a package without including the new code and the tests either failed (specific checks for NSUrlSessionHandler) or worked, because the code reverted to use the managed implementation if it could not find the specific type.

@nberardi
Copy link
Contributor Author

I apologize I don't know a lot about how your bots build packages. Do you have some documents that I can look at so that I can ensure I have everything configured correctly?

Nick Berardi
(484) 302-0125
Sent on the go from my phone.

On May 20, 2016, at 6:03 AM, Sebastien Pouliot notifications@github.com wrote:

The QA tests failed. While the old files (from ModernHttpClient) were removed from the build it looks like the new NSUrlSessionHandler.cs was not added.

As such the bots built a package without including the new code and the tests either failed (specific checks for NSUrlSessionHandler) or worked, because the code reverted to use the managed implementation if it could not find the specific type.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@spouliot
Copy link
Contributor

No need to apologize :) we missed it during the review. You're likely testing the new source file as part of your app/test code.

Just like some files were removed from src/Makefile this new file you're adding, src/Foundation/NSUrlSessionHandler.cs must be added (at the same places) to the code gets compiled in the right assemblies (which is different for XI and XM due to historical reasons, e.g. it's located in System.Net.Http.dll for XI).

I'll double check if we have (pre-QA) tests that check for this (missing type). Every PR are now built on new bots and we'll soon enable a subset of our tests on them. That should give good/bad feedback (for such cases) a lot faster.

This is a rewrite of the ModernHttpClient version of NSUrlSessionHandler, it has better handling for memory that provides a more consistant memory footprint. It accomplishes this by using NSInputStream for requests, and reading and disposing directly from NSData instead of transitioning the NSData to a byte[] array.
@nberardi
Copy link
Contributor Author

I added the files into the Makefile in the places they were previously removed. Let me know if there is anything else you see that needs to go into the commit.

@spouliot
Copy link
Contributor

build

@nberardi
Copy link
Contributor Author

nberardi commented Sep 7, 2016

@spouliot I know you are in the later stages of cycle 8 now. Let me know when you have some time to discuss next steps for this pull request for a cycle 9 release.

@spouliot
Copy link
Contributor

@nberardi I asked @mandel-macaque to follow up on the PR and QA for our cycle9 (planned to be shorter than usual).

mandel-macaque pushed a commit that referenced this pull request Sep 20, 2016
@mandel-macaque
Copy link
Member

Hello, @nberardi I'm trying to land this changes in our new development cycle yet we have identified the following bug:

401 code not returned when using NSURLSession HTTPClient handler.

I am working on a fix for it but I was wondering if you do have one and you have not yet pushed it.

@mandel-macaque
Copy link
Member

FYI I'm working on the branch new-url-session-handler

@nberardi
Copy link
Contributor Author

Do you have a repo application?

Nick Berardi
(484) 302-0125
Sent on the go from my phone.

On Sep 27, 2016, at 7:34 AM, Manuel de la Pena notifications@github.com wrote:

Hello, @nberardi I'm trying to land this changes in our new development cycle yet we have identified the following bug:

401 code not returned when using NSURLSession HTTPClient handler.

I am working on a fix for it but I was wondering if you do have one and you have not yet pushed it.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@mandel-macaque
Copy link
Member

@nberardi There is a sample attached to the bug report.

@nberardi
Copy link
Contributor Author

If I remember correctly authentication is handled through a different callback. I will take a look in this office this morning.

Nick Berardi
(484) 302-0125
Sent on the go from my phone.

On Sep 28, 2016, at 4:32 AM, Manuel de la Pena notifications@github.com wrote:

@nberardi There is a sample attached to the bug report.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@nberardi
Copy link
Contributor Author

@mandel-macaque I don't appear to have access to the attachments in bugzilla.

@nberardi
Copy link
Contributor Author

@mandel-macaque I created a simple example to get a 401 response, I cannot confirm the bugzilla bug.

        private const string UnathorizedResponse = "http://httpstat.us/401";

        private Task<bool> Run (HttpMessageHandler handler, string requestUrl, HttpStatusCode responseCode)
        {
            return Task.Run (() => TestResponseStatus (handler, requestUrl, responseCode));
        }

        private async Task<bool> TestResponseStatus (HttpMessageHandler handler, string requestUrl, HttpStatusCode responseCode)
        {
            var http = new HttpClient (handler);
            var response = await http.GetAsync (requestUrl);

            var status = response.StatusCode;
            if (response.StatusCode == responseCode)
                return true;
            else
                return false;
        }

        [Export("startDownloadUsingNewNetworkPressed:")]
        private void startDownloadUsingNewNetworkPressed(NSObject sender)
        {
            if (Run (new Test.NSUrlSessionHandler (), UnathorizedResponse, HttpStatusCode.Unauthorized).Result == true)
                Console.WriteLine ("YAH");
        }

I get back true each time.

@nberardi
Copy link
Contributor Author

@mandel-macaque I made another commit to my PR, that added a couple ConfigureAwait(false) statements that I originally forgot to add. I found this when I was doing a code review for the 401 issue.

@mandel-macaque
Copy link
Member

@nberardi Great, I'm going to land this on #932 since I did a merge with master and fix al the diff merge issues.

Once we have that we (mostly I) can look at the 401 since it is a bug that happens in the old handler and could be related to old code that has nothing to do with your work :)

Once the PR is merged I'll close this one and @spouliot once and we can move fwd.

mandel-macaque pushed a commit that referenced this pull request Oct 3, 2016
* Added rewritten NSUrlSessionHandler that handles memory better

This is a rewrite of the ModernHttpClient version of NSUrlSessionHandler, it has better handling for memory that provides a more consistant memory footprint. It accomplishes this by using NSInputStream for requests, and reading and disposing directly from NSData instead of transitioning the NSData to a byte[] array.

* Try to fix build of PR #31

* [foundation] Restore compatibility with the new NSUrlSessionHandler

Mostly my comments in PR #174

* Add support for redirection [1]
* Add support for credentials [1]
* Add support for caching [2]
* Remove 2nd dictionary lookup in GetHeaderSeparator
* Avoid extraneous cast for credentialsToUse

PR 177 [3] adds tests that ensure no commits can remove, or change
default values, for handlers.

[1] breaking changes (feature, not API)
[2] breaking change (API removal)
[3] #177

* [foundation] Restore compatibility with the new NSUrlSessionHandler

Mostly my comments in PR #174

* Add support for redirection [1]
* Add support for credentials [1]
* Add support for caching [2]
* Remove 2nd dictionary lookup in GetHeaderSeparator
* Avoid extraneous cast for credentialsToUse

PR 177 [3] adds tests that ensure no commits can remove, or change
default values, for handlers.

[1] breaking changes (feature, not API)
[2] breaking change (API removal)
[3] #177

* Try to fix build of PR #31

* prevent DEADLOCK in UI code

* Added ConfigureAwait(false) to Task.Delay to prevent DEADLOCK when the stream is being awaited on the UI thread

* added a few more ConfigureAwait(false) statments that were missed on first pass

* Fix some small style issues.

* Set the default value of AllowAutoRedirect to true.
@mandel-macaque
Copy link
Member

@nberardi Happy to say that we have merged your code in master!!!! Thx for the awesome work. Will be closing this PR since it is not longer needed :)

Again, thanks a lot for the work.

@dalexsoto dalexsoto added the community Community contribution ❤ label Feb 6, 2019
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request Mar 28, 2019
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this pull request Mar 28, 2019
lewurm added a commit to lewurm/xamarin-macios that referenced this pull request Sep 19, 2019
    frame xamarin#3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3
    frame xamarin#4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
    frame xamarin#5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156:10 [opt]
    frame xamarin#6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165:2 [opt]
    frame xamarin#7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt]
    frame xamarin#8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt]
    frame xamarin#9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt]
    frame xamarin#10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt]
    frame xamarin#11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt]
    frame xamarin#12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4
    frame xamarin#13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2
    frame xamarin#14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4
    frame xamarin#15: 0x02a64764 monotouchtest`do_icall(frame=<unavailable>, sig=0x17d70bf0, op=<unavailable>, sp=0x19498fa0, ptr=<unavailable>, save_last_error=0) at interp.c:1947:3 [opt]
    frame xamarin#16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt]
    Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame xamarin#17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame xamarin#18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame xamarin#19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
    Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame xamarin#20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    frame xamarin#21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=<unavailable>, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt]
    frame xamarin#22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=<unavailable>, params=0x00000000, exc=<unavailable>, error=0x194998b8) at mini-runtime.c:3170:12 [opt]
    frame xamarin#23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt]
    frame xamarin#24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at class-getters.h:24:1 [opt] [artificial]
    frame xamarin#25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt]
    frame xamarin#26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=<unavailable>, this_arg=<unavailable>, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt]
    frame xamarin#27: 0x02a64788 monotouchtest`do_icall(frame=<unavailable>, sig=0x17496978, op=<unavailable>, sp=0x19499d88, ptr=<unavailable>, save_last_error=0) at interp.c:1982:20 [opt]
    frame xamarin#28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt]
    RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame xamarin#29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    RuntimeMethodInfo::Invoke @ 400701852 "call" || frame xamarin#30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    MethodBase::Invoke @ 400700872 "callvirt.fast" || frame xamarin#31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
lewurm added a commit to lewurm/xamarin-macios that referenced this pull request Sep 19, 2019
    frame xamarin#3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3
    frame xamarin#4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
    frame xamarin#5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156:10 [opt]
    frame xamarin#6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165:2 [opt]
    frame xamarin#7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt]
    frame xamarin#8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt]
    frame xamarin#9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt]
    frame xamarin#10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt]
    frame xamarin#11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt]
    frame xamarin#12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4
    frame xamarin#13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2
    frame xamarin#14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4
    frame xamarin#15: 0x02a64764 monotouchtest`do_icall(frame=<unavailable>, sig=0x17d70bf0, op=<unavailable>, sp=0x19498fa0, ptr=<unavailable>, save_last_error=0) at interp.c:1947:3 [opt]
    frame xamarin#16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt]
    Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame xamarin#17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame xamarin#18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame xamarin#19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
    Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame xamarin#20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    frame xamarin#21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=<unavailable>, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt]
    frame xamarin#22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=<unavailable>, params=0x00000000, exc=<unavailable>, error=0x194998b8) at mini-runtime.c:3170:12 [opt]
    frame xamarin#23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt]
    frame xamarin#24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at class-getters.h:24:1 [opt] [artificial]
    frame xamarin#25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt]
    frame xamarin#26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=<unavailable>, this_arg=<unavailable>, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt]
    frame xamarin#27: 0x02a64788 monotouchtest`do_icall(frame=<unavailable>, sig=0x17496978, op=<unavailable>, sp=0x19499d88, ptr=<unavailable>, save_last_error=0) at interp.c:1982:20 [opt]
    frame xamarin#28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt]
    RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame xamarin#29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    RuntimeMethodInfo::Invoke @ 400701852 "call" || frame xamarin#30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    MethodBase::Invoke @ 400700872 "callvirt.fast" || frame xamarin#31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
lewurm added a commit to lewurm/xamarin-macios that referenced this pull request Sep 19, 2019
    frame xamarin#3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3
    frame xamarin#4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
    frame xamarin#5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156:10 [opt]
    frame xamarin#6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165:2 [opt]
    frame xamarin#7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt]
    frame xamarin#8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt]
    frame xamarin#9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt]
    frame xamarin#10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt]
    frame xamarin#11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt]
    frame xamarin#12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4
    frame xamarin#13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2
    frame xamarin#14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4
    frame xamarin#15: 0x02a64764 monotouchtest`do_icall(frame=<unavailable>, sig=0x17d70bf0, op=<unavailable>, sp=0x19498fa0, ptr=<unavailable>, save_last_error=0) at interp.c:1947:3 [opt]
    frame xamarin#16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt]
    Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame xamarin#17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame xamarin#18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame xamarin#19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
    Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame xamarin#20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    frame xamarin#21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=<unavailable>, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt]
    frame xamarin#22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=<unavailable>, params=0x00000000, exc=<unavailable>, error=0x194998b8) at mini-runtime.c:3170:12 [opt]
    frame xamarin#23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt]
    frame xamarin#24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at class-getters.h:24:1 [opt] [artificial]
    frame xamarin#25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt]
    frame xamarin#26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=<unavailable>, this_arg=<unavailable>, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt]
    frame xamarin#27: 0x02a64788 monotouchtest`do_icall(frame=<unavailable>, sig=0x17496978, op=<unavailable>, sp=0x19499d88, ptr=<unavailable>, save_last_error=0) at interp.c:1982:20 [opt]
    frame xamarin#28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt]
    RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame xamarin#29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    RuntimeMethodInfo::Invoke @ 400701852 "call" || frame xamarin#30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    MethodBase::Invoke @ 400700872 "callvirt.fast" || frame xamarin#31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
lewurm added a commit that referenced this pull request Sep 23, 2019
…ns (#7036)

* [coop] add missing gc_unsafe transition

    frame #3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3
    frame #4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
    frame #5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156:10 [opt]
    frame #6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165:2 [opt]
    frame #7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt]
    frame #8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt]
    frame #9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt]
    frame #10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt]
    frame #11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt]
    frame #12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4
    frame #13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2
    frame #14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4
    frame #15: 0x02a64764 monotouchtest`do_icall(frame=<unavailable>, sig=0x17d70bf0, op=<unavailable>, sp=0x19498fa0, ptr=<unavailable>, save_last_error=0) at interp.c:1947:3 [opt]
    frame #16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt]
    Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame #17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame #18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame #19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
    Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame #20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    frame #21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=<unavailable>, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt]
    frame #22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=<unavailable>, params=0x00000000, exc=<unavailable>, error=0x194998b8) at mini-runtime.c:3170:12 [opt]
    frame #23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt]
    frame #24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at class-getters.h:24:1 [opt] [artificial]
    frame #25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt]
    frame #26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=<unavailable>, this_arg=<unavailable>, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt]
    frame #27: 0x02a64788 monotouchtest`do_icall(frame=<unavailable>, sig=0x17496978, op=<unavailable>, sp=0x19499d88, ptr=<unavailable>, save_last_error=0) at interp.c:1982:20 [opt]
    frame #28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt]
    RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame #29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    RuntimeMethodInfo::Invoke @ 400701852 "call" || frame #30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    MethodBase::Invoke @ 400700872 "callvirt.fast" || frame #31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]

* [coop] relax a couple GC state assertions

* [coop] update doc for enabling GC assertions

* [coop] relax a GC assertion in release trampoline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution ❤ do-not-merge Do not merge this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants