Closed ghost closed 7 years ago
So, I think I have an idea for a fix, but what concerns me is that I'm confused about the cause. It seems that we'd be able to fix this by either using extend, or just checking remaining bytes and reserving more only when necessary (which extend does internally).
I'm not sure to what extent this issue is tied to the timing. It's clear that the panic should be happening when the buffer (which is held internally by the Framed
instance within the transport) is full (or would be more than full after adding the message). It's unclear to me if this is because you're very rarely receiving a very long message, or if this is because of something about the state of that buffer, e.g. it is not being emptied fast enough or something. Still, I think I will change it to using extend which should resolve your issue (but if the latter situation is the case, maybe there'll be memory usage issues?).
Okay, i will do some further testing with the extend change, keeping memory usage in mind. Thanks for the quick fix :+1:
Most likely, there's nothing weird going on (just the buffer getting full for some ordinary reason, and then eventually being sent on the stream and flushed). So, this should be all that's necessary.
FWIW I've been running into this too. Thanks for the fix!
Was trying to track this line for a while, made a reduced case (which is pretty much just the example on the github) and it happens for me.
crashes with:
The mentioned line is located here: https://github.com/carllerche/bytes/blob/master/src/buf/buf_mut.rs#L204
And the only place that uses that method is here: https://github.com/aatxe/irc/blob/41632b10af58537476e6339a23772a15e426a651/src/proto/line.rs#L72
I couldn't track the issue much farther than that though.
The amount of time it takes to crash is ~10 hours, and it does not appear to be related to a message that comes through from a user. I am using #rust channel for another thing so to keep it the same i used it for the test, and the times don't match up with anything a user posts. I will run it with the backtrace and see what it shows. But it will take a while. I'd be happy to test any further ideas you have on the issue.