-
Notifications
You must be signed in to change notification settings - Fork 730
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
No data found for task x, cannot append received data #1376
Comments
Weird! Is it possible it's something leaking over from an older test? |
can't see anything relevant, also it don't happen every run |
public func invalidate() {
self.clearAllTasks()
self.session?.invalidateAndCancel()
self.session = nil
} shouldn't |
Hi! Yeah flipping the cleanup order likely wouldn't help since some tasks are still in-flight, I suspect I need to actually cancel all the in-flight tasks. Thanks for the heads up on this! |
Shipped with version |
Hi @designatednerd, I am encountering this issue in That all said, it does seem that the issue is resolved by calling |
still happening in 0.36.0 (iOS12 simulator) |
same crash on me at the latest version. IOS 14.2 iPhone 12 how can i fix this ? |
This should not be crashing in versions above 0.37.0 since it's checking to see if the session is still around before it tries to perform an operation - @alkincakiralar1996 can you confirm exactly which version you're using? |
Ah sorry yes i was using older version, i update and problem resolved thanks |
That's certainly possible, but since this is an |
Yeah sure, but if we are deploing dev version to testers they have this kind of crash :< btw i think potential solution is that cancel, should cancel the task first and then remove it from tasks inside:
|
🤔 My recollection is we tried to do it the opposite way before but it was causing way more problems because the task would get cancelled before it was removed from the list of tasks, but I'd be curious to hear if flipping it solves your problem? |
I was only guessing, this is very random for me unfortunately :/ |
btw. what about checking if dataTask state == .cancelled and then asserting if not? |
I'm not sure how that would help - the assertion exists right now in the function that adds data to the task, but it's checking to ensure a task is actually in the dictionary before doing anything. Adding an assert for something that was cancelled would still cause your same problem. Honestly, I'd strongly recommend using TestFlight (which IIRC uses builds signed for release) rather than sending out builds in dev mode. You'll get a much, much more accurate reflection of real-world performance and you'll also avoid problems like this since assertions are designed to no-op when in release mode. |
But if you wil llook on line URLSessionClient:198 I am not talking only about testers, me as a developer also develop app in dev environment so it is also crashing for me sometimes because i am cancelling some tasks. In summary - i jsut think that assertions make sense if you expect that app is wrong state - in that case all is good and still we have assertion. |
The comment you're referring to is in It's reasonable to expect something that's been cancelled to call into a method that's around completion. In theory if the task has been cancelled, it should no longer be calling back into |
Yes this was exacly what i did - i triggered breakpoint or actually assertion triggers and state was == 2 so it was cancelled - thats why i wrote about this in last comment. |
Great, that's super-helpful to know, I can make some changes tomorrow that take this into account. Thank you! |
Cool thanks! |
One of our tests hitting assert in
URLSessionClient.swift:230
in on CI after updating to latest version (0.31.0).It's not networking stack test so don't think we doing anything specific to hit that assert. Looking at code that would indicate some kind race condition...
The text was updated successfully, but these errors were encountered: