Skip to content
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

Port reuse problems / SOREUSEPORT support #31

Open
ungps opened this issue Mar 15, 2023 · 0 comments
Open

Port reuse problems / SOREUSEPORT support #31

ungps opened this issue Mar 15, 2023 · 0 comments

Comments

@ungps
Copy link

ungps commented Mar 15, 2023

When spamming Unikraft HTTPserver with lots of request using curl, the server eventually gets stuck. By inspecting the pcap in Wireshark, we would see last connection would try to "TCP Port reuse" in this case.

Alternatively, instead of spaming with connections, we have a more consistent way to replicate the bug. By using --local-port 42000 (or whatever port) option in curl and just do three requests we would see a similar behaviour (but without all the clutter before Unirkaft gets stuck): first curl would work just fine. The second one will fail with the message "bind failed with errno 98: Address already in use" (or errno 7 "Failed to connect to 172.44.0.2 port 8123: Connection refused", depending on Unikraft version). After that point all other requests would get stuck.

The cause could be that LWIP does not have support for SO_REUPOSRT flag and tries to reuse the TCP port by default. Something that helped a bit was enabling LWIP_SO_LINGER and setting the SO_LINGER with timeout 0 on the socket. By doing so, we'de get back the response, but the connection is still weird. After receiving the response, the connection would be force reset: curl: (56) Recv failure: Connection reset by peer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant