Skip to content

[edge-http]: Server doesn't seem to free handler after [FIN, ACK] from client. #62

Description

@AnthonyGrondin

Using edge-net with esp-wifi and embassy-net, I'm noticing the following behaviour; When I make a curl request, without any closing headers, (Connection: Close), my client (curl) sends a [FIN, ACK] at the end of an HTTP request, which is acknowledged by an ACK from my esp32 but then the handler isn't freed and only is freed when the timeout is reached.

Here's a Wireshark log of a connection using curl, without any closing headers in the HTTP request:

  • Client: 192.168.11.50
  • Esp32: 192.168.11.1
    image

The issue is that the handler, which hasn't been liberated, isn't re-used if I immediately send another request with the same client, as it can be observed in the following logs:

INFO - [0] GET / HTTP/1.1
INFO - 200 OK: /
INFO - [1] GET / HTTP/1.1
INFO - 200 OK: /
INFO - Handler task 0: Closing connection due to inactivity
INFO - Handler task 1: Closing connection due to inactivity

Excerpts of my Cargo.toml:

esp-hal = { version = "0.23.1", features = ["unstable"] }
esp-wifi = { version = "0.12.0", features = ["wifi", "serde"] }
embassy-net = { version = "0.6.0", features = [
  "tcp",
  "udp",
  "dhcpv4",
  "dhcpv4-hostname",
  "dns",
  "medium-ethernet",
] }
smoltcp = { version = "0.12.0", default-features = false, features = [
  "multicast",
  "proto-ipv4",
  "socket-tcp",
  "socket-icmp",
  "socket-udp",
  "medium-ethernet",
  "proto-dhcpv4",
  "socket-raw",
  "socket-dhcpv4",
  "dns-max-server-count-2",
] }
edge-nal-embassy = "0.5.0"
edge-http = "0.5.0"

My server:

async fn http_server(
    stack: &'static edge_nal_embassy::Tcp<'static, 2, 4096, 4096>,
) -> Result<(), edge_http::io::Error<TcpError>> {
    let addr = "0.0.0.0:80";

    let acceptor = stack.bind(addr.parse().unwrap()).await.unwrap();

    let mut server = Server::<2, 4096, 16>::new();
    server
        .run(
            Some(15 * 1000),
            acceptor,
            Handler,
        )
        .await
}

Metadata

Metadata

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