Live data from Hacker News

The curious case of slow downloads

blog.cloudflare.com

41–50 of 57 posts

Re: The curious case of slow downloads

#42
post #34

Earlier quoted context omitted.

> Good thing the admins where nice people and didn't shoot me when I went to explain the next monday why the home drive was filled with "blah" XD They should be the ones explaining why they don't have disk quotas set up on a shared system.

AFAIR, they had one, which was so flakey they had to disable it all the time. But yeah, maybe them being somewhat at fault as well helped me out a bit :)

Sounds like a story straight from Unix-Haters Handbook... :).

Re: The curious case of slow downloads

#43
post #36

Earlier quoted context omitted.

Well the goal here seems to be aborting a connection, not just closing it. They specifically don't want to empty the buffer, because time is up. Is that a misuse of reset?

Yes, it is a misuse of a TCP reset. The RFCs are very clear about when to use a TCP reset. You can't use a reset just because you want to be fast or don't feel like sending any more data. Resets are for something abnormal happening. A timeout isn't abnormal to a TCP connection. It's part of the process.

RFC 1122[0] says:

A TCP connection may terminate in two ways: (1) the normal TCP close sequence using a FIN handshake, and (2) an "abort" in which one or more RST segments are sent and the connection state is immediately discarded.

and

A host MAY implement a "half-duplex" TCP close sequence, so that an application that has called CLOSE cannot continue to read data from the connection. If such a host issues a CLOSE call while received data is still pending in TCP, or if new data is received after CLOSE is called, its TCP SHOULD send a RST to show that data was lost.

So this behavior seems fine unless another RFC specifically prevents it.

[0] - https://tools.ietf.org/html/rfc1122#section-4.2.2.13

Re: The curious case of slow downloads

#44

Related story time: At university, we ran a local quakeworld server (yes, this was in the stone age XD). And I wanted to write a tool to allow users to control to server. It would listen on a network port and pipe its input into the quakeworld server running as a child subprocess. Sounds simple enough, right? Disregarding accept(2)ing connections,etc... it's just going to sit in an endless loop, select(2) on the sock…

You have QuakeWorld and almost a terabyte in the same story. It seriously managed to write 800 gigs!? How did they have that much storage?

Re: The curious case of slow downloads

#45
post #36

Earlier quoted context omitted.

Well the goal here seems to be aborting a connection, not just closing it. They specifically don't want to empty the buffer, because time is up. Is that a misuse of reset?

Yes, it is a misuse of a TCP reset. The RFCs are very clear about when to use a TCP reset. You can't use a reset just because you want to be fast or don't feel like sending any more data. Resets are for something abnormal happening. A timeout isn't abnormal to a TCP connection. It's part of the process.

It's absolutely a misuse and causes all kinds of assumptions which the RFCs make about how people write their software to become invalid.

It's also a simple and state-free way of influencing other devices on the network. Arbor is an interesting example - when doing DDoS mitigation, an approach which doesn't require a lot of resources or statefulness is extremely useful.

On one hand, I want to agree with you: this is terrible and makes everyone else's life harder.

On the other hand, maybe its TCP's resource requirements that are at fault.

Re: The curious case of slow downloads

#46
post #7

This is why open source (and controlling your whole stack) matters in big business. For example, Microsoft may be changing their image, but their core software is closed source. may be great, but can you pull off something like this when you've got an issue? The importance of being able to debug and patch your mission critical systems is hard to overstate. Please encourage your employer to fiscally support the open s…

> For example, Microsoft may be changing their image, but their core software is closed source. may be great, but can you pull off something like this when you've got an issue? The importance of being able to debug and patch your mission critical systems is hard to overstate. Not OSS != no source access. A cloud provider on top of the MS stack would most likely have Shared Source Initiative licenses.

> Not OSS != no source access.

Furthermore, no source access != no way to fix problems.

People have been fixing things with no source for ages, EULAs be damned. If the fix is literally flipping a single bit, the decision is easy. Just do it. The vendor doesn't need to know nor care what we did to fix it, but often giving a detailed description to them of the problem --- one that comes out of the process of fixing it --- will help them fix it quickly and distribute to their other customers too. I've had this experience a few times.

Obviously, "the byte at 0x73F441 of somefile.dll should be 31, not 32" is not how you should communicate such things to the vendor, but they do appreciate your effort in debugging the issue instead of immediately blaming it on a fault in their software. ;-)

(And relatedly, no source access != no way to find problems either, as the security community shows quite plainly...)

Re: The curious case of slow downloads

#47
Great that they solved it! My company (degoo.com) had to use CloudFront instead of CloudFlare for our binaries because of this bug. Our conversion rate went down about 10% whenever we used CloudFlare instead. Perhaps time to switch back.

Re: The curious case of slow downloads

#48
They just rediscovered silly window syndrome, but at the application level rather than the TCP level.

In early TCP implementations, if you read from a TCP connection one byte at a time, and the sender was writing faster than the receiver, the sender TCP would get an ACK opening one byte of window. The sender TCP would then transmit a packet with only one byte. This often came up if a TCP connection was driving a slow device. The fix was to not send a window update until there was at least one full packet worth of window available.

This is the same problem, but at the OS buffering level. Linux has a similar solution. The problem is 1) servers today have to protect themselves against readers that are "too slow", because that can be used as a denial of service attack, and 2) the approach to doing this was not well designed.

This is a tough one for Cloudflare, because they're in the DDOS-prevention business. They have to decide whether a slow reader is an attacker or just someone on a slow connection. Still, insisting that a reader consume at least 5MB/minute is a bit much. Some people are still on dialup.

Re: The curious case of slow downloads

#49

Related story time: At university, we ran a local quakeworld server (yes, this was in the stone age XD). And I wanted to write a tool to allow users to control to server. It would listen on a network port and pipe its input into the quakeworld server running as a child subprocess. Sounds simple enough, right? Disregarding accept(2)ing connections,etc... it's just going to sit in an endless loop, select(2) on the sock…

You have QuakeWorld and almost a terabyte in the same story. It seriously managed to write 800 gigs!? How did they have that much storage?

Wikipedia pegs QW as existing around 1996-2000...

https://en.wikipedia.org/wiki/QuakeWorld

Now, 800Gigs sounds like a lot, but I distinctly also recall that time as the era when we ran across 8GB clip issues. It wouldn't be unheard of for drives to actually be 20-60GB in size around this era, maybe larger for the expensive SCSI kind.

Getting 800GB online storage with something like RAID5 or RAID6 would probably take two fully loaded controllers; lets say 10 drives of usable storage across two arrays. (20 drives). That back of the envelope math is about 40GB per drive.

I could see this being an easy case at a LARGE university in some tech centrist area at about the timeframe of 16-18 years ago.

Re: The curious case of slow downloads

#50

Earlier quoted context omitted.

What's that cost? How quickly can it be done? If I was a developer would I have to ask my manager to look into the details of our support plan? What about the ability to patch the source? `git clone` is an incredible power. Companies should reward those who are generous with their code.

> What's that cost? How quickly can it be done? Careful with those goalposts, you're tearing up the pavement. > Companies should reward those who are generous with their code. So companies "should reward those who are generous with their code" but not compensate them for it?

> So companies "should reward those who are generous with their code" but not compensate them for it?

No, they absolutely should compensate them for it. Buy OSS.

Post reply on HN