8000 Upload hanging when using background URLSession · Issue #190 · tus/TUSKit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Upload hanging when using background URLSession #190
Open
@andriyanovDS

Description

@andriyanovDS

Hello!

I've encountered an issue with file uploads when using a background URLSession with the same identifier across multiple TUSClient instances.

Steps to Reproduce
Create two TUSClient instances using the same background URLSessionConfiguration (i.e., the same identifier).
Start an upload using the second TUSClient instance.

Problem Description
The issue arises because __NSURLBackgroundSession holds a strong reference to its delegate (TUSAPI). When a new URLSession is created in the second TUSAPI instance, it does not override the delegate of __NSURLBackgroundSession. And for some reason, the new URLSession uses the first TUSAPI instance as its delegate instead of the second one.

As a result, when starting an upload in the second TUSClient instance, the URLSession reports completions (func urlSession(_: URLSession:task:didCompleteWithError:)) to the TUSAPI belonging to the first TUSClient instance.

I'm unsure if this is intended behavior, but it seems we should not create multiple TUSClient instances when using a background session. It might be helpful to clarify this information in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0