lsquic icon indicating copy to clipboard operation
lsquic copied to clipboard

'es_honor_prst' didn't work when restart server?

Open emailsters opened this issue 3 years ago • 4 comments

Hello, i was testing the scenario of restarting the server, es_send_prst and es_honor_prst is set to 1.

Client keep sending data to server, and then, restart the server, it seems the server response RST packet to client correctly.

19:21:52.649 [DEBUG] purga: C15FFE8A22BB902D not found
19:21:52.649 [DEBUG] prq: selected 30-byte reset size for CID C15FFE8A22BB902D (range is [21, 34])
19:21:52.649 [DEBUG] prq: scheduled stateless reset packet for connection C15FFE8A22BB902D
19:21:52.649 [DEBUG] engine: scheduled stateless reset packet for cid C15FFE8A22BB902D
19:21:52.649 [DEBUG] purga: C15FFE8A22BB902D not found
19:21:52.649 [DEBUG] prq: selected 30-byte reset size for CID C15FFE8A22BB902D (range is [21, 37])
19:21:52.649 [DEBUG] prq: request for this DCID and type already exists
19:21:52.649 [DEBUG] engine: cannot schedule stateless reset packet
19:21:52.650 [DEBUG] tokgen: generated stateless reset token C7F1CF9846FB867DFA4922934E68B498 for CID C15FFE8A22BB902D
19:21:52.650 [DEBUG] engine: batched packet 0 for connection C15FFE8A22BB902D
19:21:52.650 [DEBUG] engine: packets out returned 1 (out of 1)
19:21:52.650 [DEBUG] [QUIC:C15FFE8A22BB902D] event: sent public reset packet, size 30
19:21:52.650 [DEBUG] prq: sent stateless reset packet for connection C15FFE8A22BB902D; free resources

But the client seems to drop the RST packet? The expectation is that the client can receive RST packet and close the connection or stream?

19:21:52.037 [DEBUG] engine: DCID matches no SCID in connection B8AE0E86E336BD8D: drop it

emailsters avatar May 19 '22 11:05 emailsters

it can not close the connection because can not find connection by srst,find_conn_by_srst returns NULL image

emailsters avatar May 23 '22 12:05 emailsters

  • when client and server handshake_ok, communication is ok

client: image

2022-07-14 21:48:52.895 [DEBUG] [QUIC:1747689995191188] conn: peer transport parameters: max_idle_timeout: 30000; max_udp_payload_size: 65527; init_max_data: 1572864; init_max_stream_data_bidi_local: 0; init_max_stream_data_bidi_remote: 1048576; init_max_stream_data_uni: 12288; init_max_streams_bidi: 100; init_max_streams_uni: 3; ack_delay_exponent: 3; max_ack_delay: 25; active_connection_id_limit: 8; min_ack_delay: 10000; min_ack_delay_02: 10000; timestamps: 2; loss_bits: 1; stateless_reset_token: 3CA93CAE7262875903BD6D79582AEEC2; original_destination_connection_id: 7129037138732858780; initial_source_connection_id: 1337029135967385

stateless_reset_token is 3CA93CAE7262875903BD6D79582AEEC2,as the hash key. image

server: 2022-07-14 21:48:52.892 [DEBUG] [QUIC:1747689995191188] handshake: max_idle_timeout: 30000; init_max_data: 1572864; init_max_stream_data_bidi_local: 0; init_max_stream_data_bidi_remote: 1048576; init_max_stream_data_uni: 12288; init_max_streams_bidi: 100; init_max_streams_uni: 3; ack_delay_exponent: 3; max_ack_delay: 25; active_connection_id_limit: 8; min_ack_delay: 10000; min_ack_delay_02: 10000; timestamps: 2; loss_bits: 1; stateless_reset_token: 3CA93CAE7262875903BD6D79582AEEC2; original_destination_connection_id: 7129037138732858780; initial_source_connection_id: 1337029135967385

  • but after restart(kill -9 and start again) the server. server regenerate a new token which is different with 3CA93CAE7262875903BD6D79582AEEC2

server: 2022-07-14 21:49:28.449 [DEBUG] purga: 1337029135967385 not found 2022-07-14 21:49:28.449 [DEBUG] prq: selected 21-byte reset size for CID 1337029135967385 (range is [21, 28]) 2022-07-14 21:49:28.449 [DEBUG] prq: scheduled stateless reset packet for connection 1337029135967385 2022-07-14 21:49:28.449 [DEBUG] engine: scheduled stateless reset packet for cid 1337029135967385 2022-07-14 21:49:28.449 [INFO] engine: 0000:A2 27 E2 52 6E D9 88 F1 76 FB A6 A4 FC 07 14 C4 2022-07-14 21:49:28.449 [DEBUG] tokgen: generated stateless reset token B7AF6D7FD3F6EB2ACE54F60088DEE139 for CID 1337029135967385 2022-07-14 21:49:28.449 [INFO] engine: 0000:B7 AF 6D 7F D3 F6 EB 2A CE 54 F6 00 88 DE E1 39 2022-07-14 21:49:28.449 [DEBUG] engine: batched packet 0 for connection 1337029135967385 2022-07-14 21:49:28.449 [DEBUG] engine: packets out returned 1 (out of 1) 2022-07-14 21:49:28.449 [DEBUG] [QUIC:1337029135967385] event: sent public reset packet, size 21 2022-07-14 21:49:28.449 [DEBUG] prq: sent stateless reset packet for connection 1337029135967385; free resources

client: 2022-07-14 21:49:28.731 [DEBUG] engine: DCID matches no SCID in connection 1323686819980697: drop it

  • as a result, the client can not find conn by the new reset token.

image

it is a bug or a feature?

emailsters avatar Jul 14 '22 13:07 emailsters

I think you have find the answer. It is the way it works. Since the stateless reset token is saved in memory, not in a persistent storage, restart server will lose that token. To make it survive server restarts, need to save it in a persistent storage, and then there are a lot more to consider if do that. :-)

litespeedtech avatar Jul 14 '22 14:07 litespeedtech

I think you have find the answer. It is the way it works. Since the stateless reset token is saved in memory, not in a persistent storage, restart server will lose that token. To make it survive server restarts, need to save it in a persistent storage, and then there are a lot more to consider if do that. :-)

ok,thanks : )

emailsters avatar Jul 15 '22 09:07 emailsters