Skip to content

Error in demo UDP tracker logs: failed to send. Client's port is 0 #1450

Closed

Description

@josecelano

I've seen a couple of errors like this in the tracker demo logs:

tracker  | 2025-04-14T08:52:42.491940Z  WARN process_request:send_response{client_socket_addr=*.*.*.*:0 response=Connect(ConnectResponse { transaction_id: TransactionId(I32(1163113452)), connection_id: ConnectionId(I64(8646890202544963935)) }) opt_req_kind=Some(Connect) req_processing_time=37.872µs}: torrust_udp_tracker_server::server::processor: failed to send bytes_count=16 error=Invalid argument (os error 22) payload=[0, 0, 0, 0, 69, 83, 179, 236, 119, 255, 236, 211, 118, 127, 129, 95]

The client's port is 0 (masked IP above).

The application logs the error when it tries to write the response:

let () = match self.send_packet(&client_socket_addr, payload).await {
    Ok(sent_bytes) => {
        if tracing::event_enabled!(Level::TRACE) {
            tracing::debug!(%bytes_count, %sent_bytes, ?payload, "sent {response_type}");
        } else {
            tracing::debug!(%bytes_count, %sent_bytes, "sent {response_type}");
        }

        if let Some(udp_server_stats_event_sender) =
            self.udp_tracker_server_container.udp_server_stats_event_sender.as_deref()
        {
            udp_server_stats_event_sender
                .send_event(Event::UdpResponseSent {
                    context: ConnectionContext::new(client_socket_addr, self.server_service_binding),
                    kind: udp_response_kind,
                    req_processing_time,
                })
                .await;
        }
    }
    Err(error) => tracing::warn!(%bytes_count, %error, ?payload, "failed to send"),
};

Activity

  1. josecelano commented on Jun 18, 2025

    @josecelano
    MemberAuthor

    More errors:

    tracker  | 2025-06-18T07:48:34.767822Z  WARN process_request:send_response{client_socket_addr=x.x.x.x:0 response=Connect(ConnectResponse { transaction_id: TransactionId(I32(-234128723)), connection_id: ConnectionId(I64(-2264805620120435493)) }) opt_req_kind=Some(Connect) req_processing_time=40.298µs}: torrust_udp_tracker_server::server::processor: failed to send bytes_count=16 error=Invalid argument (os error 22) payload=[0, 0, 0, 0, 242, 11, 122, 173, 224, 145, 203, 73, 183, 105, 196, 219]
    
    tracker  | 2025-06-18T08:00:27.102934Z  WARN process_request:send_response{client_socket_addr=x.x.x.x:0 response=Connect(ConnectResponse { transaction_id: TransactionId(I32(-1965620261)), connection_id: ConnectionId(I64(6620291490589005700)) }) opt_req_kind=Some(Connect) req_processing_time=24.337µs}: torrust_udp_tracker_server::server::processor: failed to send bytes_count=16 error=Invalid argument (os error 22) payload=[0, 0, 0, 0, 138, 215, 3, 219, 91, 224, 0, 8, 238, 25, 87, 132]
    
  2. self-assigned this
    on Jun 18, 2025
  3. josecelano commented on Jun 18, 2025

    @josecelano
    MemberAuthor

    We should not process the request when the client port's is 0. We should:

    • Automatically discard the request.
    • Log a warning with the client socket address.

    cc @da2ce7

  4. added 2 commits that reference this issue on Jul 22, 2026
    41b0e90
    137d213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions