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

I2pListener Fails To Accept Additional Streams If A Client Disconnects #15

Open
bonedaddy opened this issue Apr 12, 2022 · 0 comments
Open

Comments

@bonedaddy
Copy link
Contributor

bonedaddy commented Apr 12, 2022

Overview

I'm running into issues with building a tcp reverse proxy server that services multiple clients. If one of the clients disconnects without properly terminating the session, the I2PListener is unable to accept new incoming connections. As long as all clients disconnect appropriately, the server will be able to accept new connections, but the moment a client disconnects without properly terminating the connection, further calls to accept will return the following error

DEBUG 2022-04-12T01:39:26Z: i2p::sam: -> STREAM ACCEPT ID=Fb4cqmgbQwofVMYg SILENT=false

DEBUG 2022-04-12T01:39:26Z: i2p::sam: <- STREAM STATUS RESULT=INVALID_ID MESSAGE="STREAM SESSION ID Fb...wofVMYg does not exist"

ERROR 2022-04-12T01:39:26Z: server::reverse_proxy::ip: failed to accept incoming connection Error {
    inner: 
    
    Invalid stream id: STREAM SESSION ID Fb...wofVMYg does not exist,
}

Possible Causes

I've been having this issue for a few days now, and have been unable to work out why this is happening. The only inclination i have is from https://geti2p.net/en/docs/api/samv3

This makes the session ${nickname} listen for one incoming connection request from the I2P network. ACCEPT is not allowed while there is an active FORWARD on the session.

However further down the documentation notes

As of SAM 3.2, multiple concurrent pending STREAM ACCEPTs are allowed on the same session ID (even with the same port). Prior to 3.2, concurrent accepts would fail with ALREADY_ACCEPTING.

So I feel like accept should still work.

Reproduction Steps

$> git clone https://github.com/bonedaddy/b0n3r.git
$> cd b0n3r && make build
$> ./boner-cli config new # fill out server settings as needed
$> ./boner-cli utils gen-dest --dest-name <your-dest-name> # generates a destination and stores the information in the config file

Then update your config file with tunnel settings such as this:

    - in_length: 2
      in_quantity: 3
      in_backup_quantity: 6
      out_length: 2
      out_quantity: 3
      out_backup_quantity: 6
      name: yolo

Now start a test tcp socket echo server in one terminal:

$> ./boner-cli server tcp-echo --listen-ip 127.0.0.1:34430

In another terminal start up the tcp reverse proxy server using the previous tunnel and destination configuration names, which forwards requests to the tcp echo server

$>  RUST_LOG=debug ./boner-cli server reverse-proxy --destination-name <..> --tunnel-name <..> --forward-ip 127.0.0.1:34430

Now start the example client which authenticates with the reverse proxy server and solves the VDF captcha (may take upwards of 1->2 minutes).

$> RUST_LOG=debug ./boner-cli client echo --destination <base32-ip-address-of-destination>.b32.i2p:0 

Once the captcha has been solved and the client is authenticated, leave the terminals running for a bit (seems to take maybe 10 -> 15 minutes) and one of the clients will disconnect and the errors start happenign

@bonedaddy bonedaddy changed the title Difficulties With Multi-Client Server Processes I2pListener Fails To Accept Additional Streams If A Client Disconnects Apr 12, 2022
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