Skip to content

Commit

Permalink
quic: ack trace probes and timeout margin
Browse files Browse the repository at this point in the history
  • Loading branch information
akhinvasara-jumptrading committed Feb 11, 2025
1 parent 9402484 commit 918742b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/fdctl/config/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ dynamic_port_range = "8900-9000"
idle_timeout_millis = 10000

# Max delay for outgoing ACKs.
ack_delay_millis = 50
ack_delay_millis = 25

# QUIC retry is a feature to combat new connection request
# spamming. See rfc9000 8.1.2 for more details. This flag
Expand Down
5 changes: 3 additions & 2 deletions src/waltz/quic/fd_quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ fd_quic_init( fd_quic_t * quic ) {
}
state->svc_delay[ FD_QUIC_SVC_INSTANT ] = 0UL;
state->svc_delay[ FD_QUIC_SVC_ACK_TX ] = quic->config.ack_delay;
state->svc_delay[ FD_QUIC_SVC_WAIT ] = quic->config.idle_timeout;
state->svc_delay[ FD_QUIC_SVC_WAIT ] = quic->config.idle_timeout * 10;

/* Check TX AIO */

Expand Down Expand Up @@ -2706,7 +2706,8 @@ fd_quic_tls_cb_peer_params( void * context,

/* set the max_idle_timeout to the min of our and peer max_idle_timeout */
if( peer_tp->max_idle_timeout ) {
conn->idle_timeout = fd_ulong_min( (ulong)(1e6) * peer_tp->max_idle_timeout, conn->idle_timeout );
/* 10 for margin of safety */
conn->idle_timeout = 10*fd_ulong_min( (ulong)(1e6) * peer_tp->max_idle_timeout, conn->idle_timeout );
}

/* set ack_delay_exponent so we can properly interpret peer's ack_delays
Expand Down
4 changes: 4 additions & 0 deletions src/waltz/quic/fd_quic_ack_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ fd_quic_ack_pkt( fd_quic_ack_gen_t * gen,

/* Attempt to allocate another ACK queue entry */
if( gen->head - gen->tail >= FD_QUIC_ACK_QUEUE_CNT ) {
FD_DTRACE_PROBE_3( fd_quic_ack_tx_overflow, enc_level, pkt_number, now );
FD_DEBUG( FD_LOG_DEBUG(( "ACK queue overflow! (excessive reordering)" )); )
return FD_QUIC_ACK_TX_ENOSPC;
}

/* Start new pending ACK */
FD_DTRACE_PROBE_3( fd_quic_ack_range_new, enc_level, pkt_number, now );
FD_ACK_DEBUG( FD_LOG_DEBUG(( "gen=%p queue ACK for enc=%u pkt_num=%lu seq=%u",
(void *)gen, enc_level, pkt_number, gen->head )); )
fd_quic_ack_t * next_ack = fd_quic_ack_queue_ele( gen, gen->head );
Expand Down Expand Up @@ -105,6 +107,7 @@ fd_quic_gen_ack_frames( fd_quic_ack_gen_t * gen,
for( ; gen->tail != gen->head; gen->tail++ ) {
fd_quic_ack_t * ack = fd_quic_ack_queue_ele( gen, gen->tail );
if( ack->enc_level != enc_level ) {
FD_DTRACE_PROBE_2( fd_quic_ack_tx_enc_level_break, ack->enc_level, enc_level );
FD_ACK_DEBUG( FD_LOG_DEBUG(( "need encryption level %u for ACKs but have %u", ack->enc_level, enc_level )); )
break;
}
Expand Down Expand Up @@ -134,6 +137,7 @@ fd_quic_gen_ack_frames( fd_quic_ack_gen_t * gen,
if( gen->head == gen->tail ) {
gen->is_elicited = 0;
} else {
FD_DTRACE_PROBE_1( fd_quic_ack_not_all_frames_flushed, gen->head - gen->tail );
FD_ACK_DEBUG( FD_LOG_DEBUG(( "Not all ACK frames were flushed" )); )
}

Expand Down
2 changes: 1 addition & 1 deletion src/waltz/quic/tests/fuzz_quic_wire.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ LLVMFuzzerTestOneInput( uchar const * data,

/* Simulate conn timeout */
while( state->svc_queue[ FD_QUIC_SVC_WAIT ].head != UINT_MAX ) {
ulong idle_timeout_ts = conn->last_activity + quic->config.idle_timeout + 1UL;
ulong idle_timeout_ts = conn->last_activity + 10*quic->config.idle_timeout + 1UL;
fd_quic_conn_t * conn = fd_quic_conn_at_idx( state, state->svc_queue[ FD_QUIC_SVC_WAIT ].head );

/* Idle timeouts should not be scheduled significantly late */
Expand Down

0 comments on commit 918742b

Please sign in to comment.