-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Fix concurrency bug in caching transport #2026
Conversation
@mattjohnsonpint can we please have a sentry-xamarin release also ?
|
@khalilyamoun - I didn't specifically investigate this from a Xamarin perspective, but from the stack trace you gave I believe it could be a similar issue. We'll push a release of Sentry.Xamarin soon. If you still get that problem after updating, please open an issue on the sentry-xamarin repo. Thanks. |
Thank you @mattjohnsonpint, |
@khalilyamoun - Yes, but you don't have to wait at all. You can simply add Sentry 3.23.1 to your project and rebuild. The only thing bumping the version of Sentry on the Sentry.Xamarin release will do is ensure that it's current when brought in transitively. |
@mattjohnsonpint - sure, but :
I installed version 3.23.1 just to give it a try - it sadly didn't fix our issue. |
FYI, Sentry.Xamarin 1.4.4 has been released, which updates its dependency on Sentry 3.23.1 to include this fix. Sorry to hear that it didn't resolve the other issue you have. We'll continue that discussion on the issue you opened there. Thanks. |
This is basic usage and should always work:
It does work, if caching is not enabled.
However when caching is enabled, it sometimes sends the envelope, and sometimes exits the program before the envelope can be sent. It is intermittent, depending on how much time (if any) is allowed to pass for the background worker and cache worker to complete. If there's no time at all between the capture and the dispose, then the envelope isn't sent.
This is happening because there's a race condition between the normal background cache worker that is processing items within the caching transport, and the flush that occurs when the transport is disposed.
I fixed this by only allowing one thread at a time to be processing items in the cache. If the flush occurs while the cache worker is processing, it will wait asynchronously until the worker completes processing.
Added a test to demonstrate this both with and without caching. Without the fix applied, the test passes only when caching is disabled. With the fix applied, the test passes both with and without caching.
Fixes #2025