Conversation
… sessions” We store data related to each URLSession in a “SessionData” object. To map from the session to the data, we either use the background id in the session config or assume that it is the foreground session. However, there are actually *2* foreground sessions, one for longpoll routes. We used the same session data for both, which could result in bugs like completion handlers for tasks being overwritten. Add a sessionDescription to disambiguate the sessions.
jboulter11
reviewed
Dec 12, 2025
|
|
||
| - (NSString *)sessionIdWithSession:(NSURLSession *)session { | ||
| return session.configuration.identifier ?: kDBSDKForegroundSessionId; | ||
| return session.configuration.identifier ?: session.sessionDescription ?: kDBSDKForegroundSessionId; |
There was a problem hiding this comment.
Don't we need to concatenate something here? Or is that concat done later?
Contributor
Author
There was a problem hiding this comment.
SessionId maps to SessionData, and all session-scoped data gets stored on it. The issue was the regular foreground session and the longpoll one were getting the same sessionId. Tasks are stored on the sessiondata and looked up by their id. Example here
There was a problem hiding this comment.
Ah okay I understand now. Thank you!
jboulter11
approved these changes
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We store data related to each URLSession in a “SessionData” object. To map from the session to the data, we either use the background id in the session config or assume that it is the foreground session.
However, there are actually 2 foreground sessions, one for longpoll routes. We used the same session data for both, which could result in bugs like completion handlers for tasks being overwritten.
Add a sessionDescription to disambiguate the sessions.