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

Upload crashes using a background URLSession #271

Closed
3 of 9 tasks
CraigSiemens opened this issue Dec 6, 2018 · 6 comments
Closed
3 of 9 tasks

Upload crashes using a background URLSession #271

CraigSiemens opened this issue Dec 6, 2018 · 6 comments

Comments

@CraigSiemens
Copy link

Platform:

  • iOS
  • tvOS
  • MacOS
  • watchOS

Swift:

  • Yes -> If yes, which version? 4.2.1
  • No

sentry-cocoa installed with:

  • CocoaPods
  • Carthage
  • Manually

Version of sentry-cocoa:
4.1.0


I have following issue:
If the app is stuck in a state where it crashes on launch, the crashes are never sent to sentry. These types of crashes do appear on Crashlytics.

If your app is running on an OS that supports it (OS X 10.9+, iOS 7.0+), Crashlytics will submit most reports using out-of-process background networking operations. This results in a significant improvement in reliability of reporting, as well as power and performance wins for your users.

Source: Crashlytics.h

Steps to reproduce:

Client.shared = try Client(dsn: "...")
try Client.shared?.startCrashHandler()
Client.shared?.crash()

Actual result:
Crash logs never show up on sentry until the bug is fixed and deployed to the app that is crashing

Expected result:
Sentry should create the network request to upload the crash by using a background URLSession. This would allow the system to handle uploading the crash even if the app is unable to run.

@HazAT
Copy link
Member

HazAT commented Dec 7, 2018

Hmm, we are using NSURLSession but with ephemeralSessionConfiguration.
Not sure, maybe we want to switch to backgroundSessionConfigurationWithIdentifier.

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];

@CraigSiemens
Copy link
Author

CraigSiemens commented Dec 7, 2018

That would be part of the required change. Background session also don't support completion handlers or data tasks. It would need to be changed to use the URLSessionDelegate methods and upload/download tasks. Using delegate methods would be a bit of work since it's already using completion blocks but switching to upload tasks should be easy since you're already writing a file to disk which is required for background uploads.

https://developer.apple.com/documentation/foundation/url_loading_system/downloading_files_in_the_background
(Also applies to uploads)

@fetzig fetzig self-assigned this Nov 29, 2019
@philipphofmann
Copy link
Member

This issue could be fixed with fixing #316

@github-actions
Copy link

github-actions bot commented Nov 8, 2021

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@philipphofmann
Copy link
Member

This is a duplicate of #316.

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

No branches or pull requests

4 participants