-
Notifications
You must be signed in to change notification settings - Fork 10
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
Panic #45
Comments
I have also noticed this piece of code: https://github.com/narrowlink/ipstack/blob/main/src/stream/tcp.rs#L459-L462 Note that early return there on |
I'm using |
The problem is looks related to the logic of tcp stack, and I don't believe that it can be fixed by taking. If the function returns UnexpectedEof, it means the stream is terminated, and poll_flush won't be called anymore! Based on what you provided, ipstack received a retransmission of data that is not available in the inflight_packets anymore, as you mentioned. There are two reasons that this can happen:
I intentionally left the panic there because I suspected the accuracy of the check_pkt_type for this part and aimed to identify the potential miscalculation. |
The problem is that |
inflight_packets should not be empty at this stage. |
I suspect that a regression occurred here: 2d54e7e |
self.inflight_packets.retain(|p| {
let last_byte = p.seq.wrapping_add(p.payload.len() as u32);
last_byte.saturating_sub(self.last_ack) > 0
&& self.seq.saturating_sub(last_byte) > 0
}); I am suspected to this part, 'seq' in 'inflight_packets' refers to the packet's sequence at the time it was pushed into the buffer. 'p.seq + 1' indicates the first byte, while 'p.seq' itself isn't available in the buffer. |
|
If I would understand the meaning of the |
@SajjadPourali patched it as per your suggestion. Will run the ipstack the entire day and monitor logs. f64ca2c |
In the TCB of ipstack, "last_ack" means the last byte acknowledged by the peer (i.e., SND.UNA), and "seq" is the last byte sent and still not acknowledged (i.e., SND.NEXT).
|
Then yes, checking for |
Using 0.0.9. Caught a panic today:
By looking at the code issuing the panic I can conclude that
inflights_packets
is empty, because only four lines are logged and the loop is entirely skipped.What's really going on in this piece of code? Maybe it shouldn't panic if there are no more inflight packets to flush?
The text was updated successfully, but these errors were encountered: