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

Xamarin.iOS Threadpool randomly halts when app is suspended and doesn't recover when resumed #12318

Open
rolfbjarne opened this Issue Jan 8, 2019 · 15 comments

Comments

Projects
None yet
5 participants
@rolfbjarne
Copy link
Member

rolfbjarne commented Jan 8, 2019

From @UmeshKanyal on June 4, 2018 19:35

We are facing exactly the same issue as mentioned in Bug58633
Do we have any resolution to the above issue?

We also use Bluetooth, geofence, beacon, background location, background fetch.
The ThreadPool randomly stops processing when the app is suspended and brought to the foreground. The main thread keeps on working but no background thread.
We have observed this issue on one specific iPhone 6s with 11.4 device, it works pretty well on rest of the other devices.

Copied from original issue: xamarin/xamarin-macios#4178

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

From @dalexsoto on June 5, 2018 16:55

Hello @UmeshKanyal any chance you have a reproducible test case for this scenario? if not could you provide some logs using this suggestion https://bugzilla.xamarin.com/show_bug.cgi?id=58633#c7?

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

From @UmeshKanyal on June 5, 2018 20:36

Hi @dalexsoto, I am using the Visual studio for mac, not sure how can I set 'MONO_LOG_LEVEL=debug' and 'MONO_LOG_MASK=threadpool'.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

From @jonathanantoine on December 28, 2018 8:59

Hello. Any update on this ? This is quite frightening to have this bug in the wild :(

@dalexsoto I think I have a repro for this issue and I created a dedicated issue : xamarin/xamarin-macios#5333

Can you help me on this ?

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

From @jgiacomini on December 28, 2018 11:20

Same for me I had this bug on one my app :(
I don't know how to solve it :'(

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

The environment variables can be set by adding the following to the additional mtouch arguments in the project's iOS Build options:

--setenv:MONO_LOG_LEVEL=debug --setenv:MONO_LOG_MASK=threadpool

Any output will be printed to the Application Output in the IDE.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

I'm also moving this issue to the mono repo, since that's where the threadpool code is.

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 8, 2019

@luhenry does the threadpool use sockets? If so, this might be relevant: https://developer.apple.com/library/archive/technotes/tn2277/_index.html

@jahmai

This comment has been minimized.

Copy link

jahmai commented Jan 8, 2019

Glad to see this issue finally getting some attention. Subscribed.

@marek-safar

This comment has been minimized.

Copy link
Member

marek-safar commented Jan 9, 2019

@luhenry could you please assess the impact?

@luhenry

This comment has been minimized.

Copy link
Member

luhenry commented Jan 11, 2019

@rolfbjarne the threadpool in itself doesn't uses sockets. The implementation of how the threadpool wakes up threads has changed as well, it went from a cond variable to a semaphore. So I am curious if it still reproduces with the latest version of Xamarin.iOS.

@jahmai

This comment has been minimized.

Copy link

jahmai commented Jan 11, 2019

@luhenry We accidentally reverted our workaround for this issue back around September ‘18 (using the latest Xam version at the time) and the issue reproduced. Did the latest build at that time include the semaphore change?

@luhenry

This comment has been minimized.

Copy link
Member

luhenry commented Jan 11, 2019

@jahmai VS 15.8 was the first release with the switch from cond variable to semaphore. Is that the version you tried back in September 2018?

@jahmai

This comment has been minimized.

Copy link

jahmai commented Jan 12, 2019

@luhenry Going by appstore logs, our bug was released on August 15 (AEST). According to the VS release notes, 15.8 was first released on August 14 (EST?). It is highly unlikely we updated to 15.8 the day we released, but do you know of any way we can confirm if we have the IPA? (The assemblies in the IPA are all stripped of code - just method signatures, but there are AOT'd binaries of things like Xamarin.iOS).

@rolfbjarne

This comment has been minimized.

Copy link
Member

rolfbjarne commented Jan 14, 2019

It is highly unlikely we updated to 15.8 the day we released, but do you know of any way we can confirm if we have the IPA?

The app's Info.plist contains the Xamarin.iOS version used to build it:

<key>com.xamarin.ios</key>
<dict>
	<key>Version</key>
	<string>12.2.1.9 (d15-9: 628409554)</string>
</dict>
@jahmai

This comment has been minimized.

Copy link

jahmai commented Jan 14, 2019

Seems not: 11.12.0.4 (d15-7: 64fece5f)
So I'll have to attempt a reproduction when I have some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment