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

SWIFT TASK CONTINUATION MISUSE thrown by library #1

Open
sameersyd opened this issue May 13, 2023 · 1 comment
Open

SWIFT TASK CONTINUATION MISUSE thrown by library #1

sameersyd opened this issue May 13, 2023 · 1 comment

Comments

@sameersyd
Copy link

I have a getAllScenes function, which calls the library's sendRequest function.

func getAllScenes() {
    Task {
        let response = try? await session.sendRequest(OBSRequests.GetSceneList())
        print("Scenes = ", response)
    }
}

It works perfectly, except sometimes the function doesn't return anything. It breaks in-between without any crash and when I checked the logs, it shows:

SWIFT TASK CONTINUATION MISUSE: firstValue leaked its continuation!
2023-05-13 16:35:14.339216-0700 StreamDeck[63058:7288398] SWIFT TASK CONTINUATION MISUSE: firstValue leaked its continuation!

I believe it should be caused by the WSPublisher library used by OBSwiftSocket. Can you please look into this and fix soon, as it gets difficult to predict if the function is going to work or break in-between. Thanks in advance!

@edonv
Copy link
Owner

edonv commented May 15, 2023

Hi Sameer! Unfortunately, I don't have a ton of time in life at the moment to dig into this, but at first glance, the issue might be on your end. I'm not 100% an export in Swift concurrency, but I think if you have a function like yours that just creates a Task without storing a reference somewhere, the task can be lost, which would result in it not completing. And with that error message, it hints towards my theory. A continuation and a leak would refer to the async task not being kept in memory long enough to complete (because there's no reference, it thinks nothing is waiting on it hence it disappearing). Maybe try restructuring your usage of Task and see if that changes things.

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

No branches or pull requests

2 participants