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

[SR-15214] corelibs-foundation URLSession spams slow delegates with more messages than they can handle #3204

Open
TellowKrinkle opened this issue Sep 19, 2021 · 1 comment

Comments

@TellowKrinkle
Copy link

Previous ID SR-15214
Radar rdar://problem/83315554
Original Reporter @TellowKrinkle
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 0c8b298e4a170e8fda01043382b14585

Issue Description:

To reproduce: Run the attached swift file

MacOS Foundation seems to implement some sort of backpressure / coalescing mechanism

Result on macOS 11.5.2(20G95)

Received 8192 bytes, totalling 8192 (queue backlog: 0)...
Received 36864 bytes, totalling 45056 (queue backlog: 0)...
Received 45056 bytes, totalling 90112 (queue backlog: 0)...
Received 53248 bytes, totalling 143360 (queue backlog: 0)...
Received 81920 bytes, totalling 225280 (queue backlog: 0)...
Received 77824 bytes, totalling 303104 (queue backlog: 0)...
Received 110592 bytes, totalling 413696 (queue backlog: 0)...
Received 118784 bytes, totalling 532480 (queue backlog: 0)...
Received 139264 bytes, totalling 671744 (queue backlog: 0)...
Received 196608 bytes, totalling 868352 (queue backlog: 0)...
Received 229376 bytes, totalling 1097728 (queue backlog: 0)...
Cancelling!

Result on Linux + Swift 5.4.3-Release

Received 3072 bytes, totalling 3072 (queue backlog: 4)...
Received 1024 bytes, totalling 4096 (queue backlog: 11)...
Received 3072 bytes, totalling 7168 (queue backlog: 24)...
Received 1024 bytes, totalling 8192 (queue backlog: 44)...
Received 3072 bytes, totalling 11264 (queue backlog: 66)...
Received 1024 bytes, totalling 12288 (queue backlog: 69)...
Received 3072 bytes, totalling 15360 (queue backlog: 104)...
Received 1024 bytes, totalling 16384 (queue backlog: 155)...
Received 3072 bytes, totalling 19456 (queue backlog: 220)...
// Trimmed because very long
Received 3072 bytes, totalling 1190912 (queue backlog: 156994)...
Cancelling!
Received 1024 bytes, totalling 1191936 (queue backlog: 156993)...
Cancelling!
Received 3072 bytes, totalling 1195008 (queue backlog: 156992)...
Cancelling!
Received 1024 bytes, totalling 1196032 (queue backlog: 156991)...
Cancelling!
// I'd expect 156991 more messages but I don't want to wait that long

Obviously this won't happen as badly if you don't sleep in your delegate, but I've still experienced huge amounts of pileup with fast internet and a slow computer

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants