Skip to content

[Bug]: TCP Port Forwarding Fails: Connection succeeds but data stream times out #794

@Lukas2019

Description

@Lukas2019

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

The following steps use a public mail server container to reliably reproduce the issue.

  1. On macOS 26, run the marlonb/mailcrab:latest container and map the SMTP port:

    container run --rm -p 1025:1025 marlonb/mailcrab:latest
  2. From the host terminal, confirm that the port is open and the TCP handshake succeeds using nc. This step will report instant success.

    nc -vz -4 localhost 1025

    Successful Output: Connection to localhost port 1025 [tcp/blackjack] succeeded!

  3. Next, attempt to communicate with the service using a protocol-aware client like curl. This step will hang for 2 minutes and fail with a timeout.

    # This command attempts to send a basic email via SMTP
    curl -v smtp://127.0.0.1:1025 --mail-from "[email protected]" --mail-rcpt "[email protected]" --upload-file /dev/null

Current behavior

The curl command successfully establishes the TCP connection but then times out waiting for the initial server response, which never arrives. The connection is held open for 2 minutes before failing.

The exact verbose output is:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1:1025...
* Connected to 127.0.0.1 (127.0.0.1) port 1025
  0     0    0     0    0     0      0      0 --:--:--  0:01:59 --:--:--     0* server response timeout
  0     0    0     0    0     0      0      0 --:--:--  0:02:00 --:--:--     0
* Closing connection
curl: (28) server response timeout

This demonstrates that the initial connection is accepted (* Connected to ...), but the data proxy is failing, causing the timeout.

Expected behavior

The curl command should successfully connect and communicate with the SMTP server inside the container, receiving a 220 mailcrab welcome banner and subsequent protocol messages, and then exit cleanly.

Environment

- OS: 26.0.1 
- Container: 0.5.0

Relevant log output

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions