rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
8.82k stars 441 forks source link

Connection dies after a while when deploying on fly.io #306

Open tagener-noisu opened 7 months ago

tagener-noisu commented 7 months ago

Describe the bug

I've encountered a weird behavior when I deployed on fly.io. The connection works fine at first, but then the webserver stops responding. If I test the same containers on a local machine everything works fine and there are no error messages in the logs. I feel like fly change the connection somehow, but I don't know how to ask about it on their forums. Can you describe what do those error messages mean?

To Reproduce Steps to reproduce the behavior:

  1. Create Dockerfile
    FROM rapiz1/rathole
    COPY ./config.toml /app/config.toml
    CMD ["--server", "/app/config.toml"]
  2. Deploy on fly.io

Configuration Configuration used to reproduce the behavior:

Server:

[server]
bind_addr = "0.0.0.0:7003"

[server.services.webserver]
token = "TOKEN HERE"
bind_addr = "0.0.0.0:8080"

Client:

[client]
remote_addr = "tnoisu.fly.dev:7003"

[client.services.webserver]
token = "TOKEN HERE"
local_addr = "libreddit:8080"

Logs

Client logs:

client_1     | 2023-11-11T00:35:34.432314Z  INFO config_watcher{path="/app/config.toml"}: rathole::config_watcher: Start watching the config
client_1     | 2023-11-11T00:35:34.995333Z  INFO handle{service=webserver}:run: rathole::client: Control channel established
client_1     | 2023-11-11T00:35:35.264566Z  WARN handle{service=webserver}:run: rathole::client: Failed to run the data channel: Failed to read cmd: early eof
client_1     | 2023-11-11T00:35:35.265458Z  WARN handle{service=webserver}:run: rathole::client: Failed to run the data channel: Failed to read cmd: early eof
client_1     | 2023-11-11T00:35:35.265672Z  WARN handle{service=webserver}:run: rathole::client: Failed to run the data channel: Failed to read cmd: early eof

Server logs:

Nov 11 00:35:35.442 WARN connection{addr=172.16.159.90:38538}: rathole::server: Data channel has incorrect nonce
Nov 11 00:35:35.447 WARN connection{addr=172.16.159.90:38544}: rathole::server: Data channel has incorrect nonce
Nov 11 00:35:35.447 WARN connection{addr=172.16.159.90:38546}: rathole::server: Data channel has incorrect nonce 

Environment: