Comments (8)
This also partially defeats the protections added in #330.
from quinn.
Not sure if this is the fastest for your uses, but I've tried tackling this issue through https://github.com/fairingrey/byte_sequencer.
It makes one assumption:
- The stream isn't corrupted -- That is, duplicate bytes received in a stream frame will always remain the same
It also won't pop redundant chunks from the binary heap in the case that a larger surrounding chunk is received (this is another worst case scenario). If a chunk of bytes in the range [2,3)
is received first, and then a chunk of bytes from [1,4)
or [0,5)
is received afterwards, then the sequencer will continue to write both to the buffer despite the redundant information in the first chunk (it will write the second first, as it has an offset closer to 0).
Would love some improvement and review if possible, since I don't often write high-performance components...
from quinn.
The stream isn't corrupted -- That is, duplicate bytes received in a stream frame will always remain the same
This assumption is endorsed by the QUIC draft, so as long as resource consumption remains sane and behavior remains well-defined, relying on it is just fine.
from quinn.
Per discussion on the rust community discord, as of this writing the above code can be induced by an attacker to consume O(nĀ²) space, which is better than unbounded but still not ideal.
from quinn.
I'm guessing we should maybe introduce a different mode here, where we switch to a different approach when we detect that the peer is doing something that might result in bad performance. I suppose we can still get rid of the duplicate data without a large performance penalty, but then we potentially still have the problem fragmented memory slices keeping many largish allocations alive.
from quinn.
I think an adequate solution to that would be copying stream data into fresh allocations whenever it's less than, say, half the size of the UDP buffer it was read into.
from quinn.
I suspect both of these were fixed by #598, but we should verify carefully.
from quinn.
I've reviewed the current behavior. The first case was indeed fixed by #598, but the latter case (roughly) remains. Closing in favor of #735 which describes the remaining issue in greater detail.
from quinn.
Related Issues (20)
- The custom version of the api is weird HOT 5
- perf_server expects private key to be in DER format, but --help says PEM
- MSQUIC Client talking with QUINN Endpoint HOT 6
- Add `SendStream::is_fully_acked` HOT 4
- Support BoringSSL HOT 32
- [Bug] CI test failure for quinn-proto on i386 HOT 1
- The client can't reach the server on windows 11 HOT 2
- 0-RTT key lifecycle HOT 3
- Allow a SendStream to buffer until more than a full packet is available HOT 5
- Clarify if `Event::ConnectionLost` is always emitted HOT 3
- Consider Pargue (L4S-compliant) congestion control support HOT 2
- `libc::sendmmsg` is not available on old Android phones HOT 3
- Proto: Ergonomics: Events are emitted before accepting stream HOT 7
- question, not an issue: What is the cost of open/close an unistream HOT 4
- timeout unexpectedly HOT 2
- sendmmsg fails with EINVAL on Android HOT 6
- Proto: Provide explicit MAX_STREAMS control. HOT 10
- Certificate error HOT 2
- Use windows-bindgen crate to limit downloads/version bumps HOT 2
- 0.10 release planning HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quinn.