{"action":"created","issue":{"url":"https://api.github.com/repos/mono/mono/issues/7786","repository_url":"https://api.github.com/repos/mono/mono","labels_url":"https://api.github.com/repos/mono/mono/issues/7786/labels{/name}","comments_url":"https://api.github.com/repos/mono/mono/issues/7786/comments","events_url":"https://api.github.com/repos/mono/mono/issues/7786/events","html_url":"https://github.com/mono/mono/issues/7786","id":307888876,"number":7786,"title":"\"mono/metadata/threads.c:3016, condition `internal' not met\" under certain conditions with the soft debugger attached","user":{"login":"brendanzagaeski","id":4934473,"avatar_url":"https://avatars3.githubusercontent.com/u/4934473?v=4","gravatar_id":"","url":"https://api.github.com/users/brendanzagaeski","html_url":"https://github.com/brendanzagaeski","followers_url":"https://api.github.com/users/brendanzagaeski/followers","following_url":"https://api.github.com/users/brendanzagaeski/following{/other_user}","gists_url":"https://api.github.com/users/brendanzagaeski/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanzagaeski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanzagaeski/subscriptions","organizations_url":"https://api.github.com/users/brendanzagaeski/orgs","repos_url":"https://api.github.com/users/brendanzagaeski/repos","events_url":"https://api.github.com/users/brendanzagaeski/events{/privacy}","received_events_url":"https://api.github.com/users/brendanzagaeski/received_events","type":"User","site_admin":false},"labels":[{"id":771392418,"url":"https://api.github.com/repos/mono/mono/labels/area-Runtime:%20Threading","name":"area-Runtime: Threading","color":"d4c5f9","default":false},{"id":781950435,"url":"https://api.github.com/repos/mono/mono/labels/regression","name":"regression","color":"7FFF00","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/mono/mono/milestones/2","html_url":"https://github.com/mono/mono/milestone/2","labels_url":"https://api.github.com/repos/mono/mono/milestones/2/labels","id":2972469,"number":2,"title":"2017-12 (5.10.xx)","description":"It also tracks dev15-7 work","creator":{"login":"marek-safar","id":250852,"avatar_url":"https://avatars1.githubusercontent.com/u/250852?v=4","gravatar_id":"","url":"https://api.github.com/users/marek-safar","html_url":"https://github.com/marek-safar","followers_url":"https://api.github.com/users/marek-safar/followers","following_url":"https://api.github.com/users/marek-safar/following{/other_user}","gists_url":"https://api.github.com/users/marek-safar/gists{/gist_id}","starred_url":"https://api.github.com/users/marek-safar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marek-safar/subscriptions","organizations_url":"https://api.github.com/users/marek-safar/orgs","repos_url":"https://api.github.com/users/marek-safar/repos","events_url":"https://api.github.com/users/marek-safar/events{/privacy}","received_events_url":"https://api.github.com/users/marek-safar/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":128,"state":"open","created_at":"2017-12-11T18:23:01Z","updated_at":"2018-03-27T20:58:47Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2018-03-23T03:20:09Z","updated_at":"2018-03-27T21:36:45Z","closed_at":"2018-03-26T15:58:30Z","author_association":"CONTRIBUTOR","body":"This report is based on [Xamarin Bugzilla Bug 61261](https://bugzilla.xamarin.com/show_bug.cgi?id=61261) and a corresponding [Developer Community report](https://developercommunity.visualstudio.com/content/problem/221192/android-application-crashing-with-condition-intern.html).\r\n\r\n## Regression status: regression in `2017-10` starting at <https://github.com/mono/mono/commit/ce89e4c5fa46a4d8225f43339fab0b0574f81cfe>\r\n\r\n- Bad: [xamarin/xamarin-android/master@cf185ad](https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-builds-master/540/) (with mono/mono/2017-10 @ ce89e4c)\r\n- Good: [xamarin/xamarin-android/master@34966de](https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-builds-master/539/) (with mono/mono/2017-10 @ 63e8dc6)\r\n\r\nAs a rough guess, maybe the changes to `mono_thread_detach_internal()` in ce89e4c introduced an unexpected timing dependency between the calls to `mono_thread_detach_internal()` and `thread_detach()`?\r\n\r\nThe problem also happens with [xamarin/xamarin-android/master@79f3707](https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-builds-master/573/) (mono/mono/2017-12 @ fbc4f05). There are some newer commits to threads.c on `2018-02` and `master`, but there are not yet CI packages of Xamarin.Android for those newer branches, so I have not yet tested with those newer changes.\r\n\r\n## Steps to reproduce\r\n\r\n1. `git clone https://github.com/Zebra/samples-emdkforxamarin-2_5.git`\r\n2. `cd samples-emdkforxamarin-2_5; git checkout BarcodeSample1`\r\n3. Connect the Zebra barcode scanner device. Make sure `adb devices` sees it.\r\n4. Build and start debugging the app from Visual Studio. (I tested with Visual Studio for Mac.)\r\n5. When the application UI appears, enable the **Continuous** checkbox. Then tap the **Start** button.\r\n6. Press and release the device's hardware barcode scan trigger button a few times.\r\n\r\nI was only able to reproduce the problem with the debugger attached.\r\n\r\n### Additional notes\r\n\r\nI was also able to reproduce the problem when the application was connected to the `sdb` command line debugger client. For that scenario, I replaced step 4 with the following steps:\r\n\r\n1. Set the device to listen for TCP `adb` connections: `adb tcpip 5555`.\r\n2. Disconnect the device's USB cable from the computer.\r\n3. Connect to the device over TCP: `adb connect 192.168.2.2` (adjust the IP address as needed).\r\n4. Set the soft debugger agent in the app to wait for a connection on startup: `adb shell setprop debug.mono.extra debug=192.168.2.2:12345,timeout=2000000000,loglevel=2,server=y`.\r\n5. Build and deploy the app: `msbuild /t:Install /p:Configuration=Debug`.\r\n6. Tap the app to start it on the device.\r\n7. Launch `sdb-dev` and connect to the app from the `(sdb)` prompt: `connect 192.168.2.8 12345`.\r\n8. Enable the **Continuous** checkbox, tap **Start**, and use the barcode scan trigger as before.\r\n\r\n## Current Behavior\r\n\r\nThe application crashes after one or more clicks of the barcode scan trigger button. Here is an excerpt from the end of the `adb logcat` log:\r\n\r\n```txt\r\n21:56:44.761 E/mono    (11003): [0x64c94f00] Thread started, obj=0x62ae0698, tls=0x64e5cee0.\r\n21:56:44.761 E/mono    (11003): [0x40027154] Suspended.\r\n21:56:44.761 E/mono    (11003): [dbg] Command VM(RESUME) [92][at=fffee4c8].\r\n21:56:44.761 E/mono    (11003): [0x64c94f00] Suspending vm...\r\n21:56:44.761 E/mono    (11003): [0x64c94f00] Sent 1 events THREAD_START(26), suspend=2.\r\n21:56:44.761 E/mono    (11003): [0x64c94f00] Suspended.\r\n21:56:44.761 E/mono    (11003): [0x63802830] Resuming vm, suspend count=1...\r\n21:56:44.771 E/mono    (11003): [dbg] Command OBJECT_REF(GET_INFO) [93][at=fffee4cb].\r\n21:56:44.771 E/mono    (11003): [dbg]   send class [System.Threading.Thread]\r\n21:56:44.771 E/mono    (11003): [dbg] Command THREAD(GET_NAME) [94][at=fffee4ce].\r\n21:56:44.771 E/mono    (11003): [dbg] Command THREAD(GET_INFO) [95][at=fffee4d0].\r\n21:56:44.771 E/mono    (11003): [dbg] Command THREAD(GET_ID) [96][at=fffee4d2].\r\n21:56:44.781 E/mono    (11003): [dbg] Command VM(RESUME) [97][at=fffee4d5].\r\n21:56:44.781 E/mono    (11003): [0x63802830] Resuming vm, suspend count=0...\r\n21:56:44.781 E/mono    (11003): [0x64e67080] Resumed.\r\n21:56:44.781 E/mono    (11003): [0x64c94f00] Resumed.\r\n21:56:44.781 E/mono    (11003): [0x64c94f00] Suspended.\r\n21:56:44.781 E/mono    (11003): [0x64c94f00] Resumed.\r\n21:56:44.781 E/mono    (11003): [0x40027154] Resumed.\r\n21:56:44.781 F/        (11003): * Assertion at /Users/builder/jenkins/workspace/xamarin-android/xamarin-android/external/mono/mono/metadata/threads.c:3016, condition `internal' not met\r\n```\r\n[logcat.txt](https://github.com/mono/mono/files/1840049/logcat.txt)\r\n\r\n## Expected Behavior\r\n\r\nWith [xamarin/xamarin-android/master@34966de](https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android-builds-master/539/), the app never crashes, even after many clicks of the scan trigger.\r\n\r\n## Additional testing environment info (brief)\r\n\r\nmacOS 10.12.6\r\nUS English locale\r\n\r\nDevice: TC700H, Android 4.4.3\r\n\r\n### On which platforms did you notice this\r\n\r\n\\[x\\] Android\r\n\\[ \\] macOS\r\n\\[ \\] Linux\r\n\\[ \\] Windows"},"comment":{"url":"https://api.github.com/repos/mono/mono/issues/comments/376684000","html_url":"https://github.com/mono/mono/issues/7786#issuecomment-376684000","issue_url":"https://api.github.com/repos/mono/mono/issues/7786","id":376684000,"user":{"login":"brendanzagaeski","id":4934473,"avatar_url":"https://avatars3.githubusercontent.com/u/4934473?v=4","gravatar_id":"","url":"https://api.github.com/users/brendanzagaeski","html_url":"https://github.com/brendanzagaeski","followers_url":"https://api.github.com/users/brendanzagaeski/followers","following_url":"https://api.github.com/users/brendanzagaeski/following{/other_user}","gists_url":"https://api.github.com/users/brendanzagaeski/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanzagaeski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanzagaeski/subscriptions","organizations_url":"https://api.github.com/users/brendanzagaeski/orgs","repos_url":"https://api.github.com/users/brendanzagaeski/repos","events_url":"https://api.github.com/users/brendanzagaeski/events{/privacy}","received_events_url":"https://api.github.com/users/brendanzagaeski/received_events","type":"User","site_admin":false},"created_at":"2018-03-27T21:36:45Z","updated_at":"2018-03-27T21:36:45Z","author_association":"CONTRIBUTOR","body":"Evaluation for possible inclusion of this fix into the `d15-6` branches of the Xamarin SDKs is in-progress. Depending on the outcome of that evaluation, I will add another comment here to indicate whether to proceed with the merge into the `d15-6-2017-10` branch. Thanks!"}}
{"actor":{"display_login":"brendanzagaeski"}}