Opened 4 years ago

Closed 3 years ago

#1593 closed defect (fixed)

HTTPBidirProxy broken

Reported by: sponge Owned by:
Priority: critical Milestone: 0.9.21
Component: apps/i2ptunnel Version: 0.9.20
Keywords: Cc:
Parent Tickets:

Description

ERROR [7.0.0.1:4488] tunnel.I2PTunnelHTTPBidirProxy: Error listening for connections on /127.0.0.1 port 4488
java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:382)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at net.i2p.i2ptunnel.I2PTunnelClientBase.run(I2PTunnelClientBase.java:688)
        at java.lang.Thread.run(Thread.java:744)
        at net.i2p.util.I2PThread.run(I2PThread.java:107)

and...

Starting tunnel sponge.i2p...
Client ready, listening on 127.0.0.1:4488
Client ready, listening on 127.0.0.1:4488
Error listening for connections on /127.0.0.1 port 4488: java.net.BindException: Address already in use
Stopping client 4488 -> HTTPClient [NO PROXIES]
Ready!
Tunnels ready for server at 127.0.0.1:7658

Starts twice then fails?
Who broke it? :-)

Subtickets

Change History (6)

comment:1 Changed 4 years ago by str4d

The client-side is being started twice in I2PTunnelHTTPBidirServer.finishSetupI2PTunnelHTTPBidirServer() - once by the I2PTunnelHTTPClient constructor, and again by the I2PTunnelHTTPClient.startRunning() call.

The short-term fix is to remove the startRunning() call. The long-term fix is to stop I2PTunnelHTTPClient starting its tunnels in its constructor.

INFO  [er str4d.i2p] net.i2p.i2ptunnel.I2PTunnel   : [3]:  session added: Session: XXXX[str4d.i2p]: 
java.lang.Exception
	at net.i2p.i2ptunnel.I2PTunnel.addSession(I2PTunnel.java:339)
	at net.i2p.i2ptunnel.I2PTunnelServer.createManager(I2PTunnelServer.java:219)
	at net.i2p.i2ptunnel.I2PTunnelServer.<init>(I2PTunnelServer.java:131)
	at net.i2p.i2ptunnel.I2PTunnelHTTPServer.<init>(I2PTunnelHTTPServer.java:181)
	at net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer.<init>(I2PTunnelHTTPBidirServer.java:20)
	at net.i2p.i2ptunnel.I2PTunnel.runHttpBidirServer(I2PTunnel.java:794)
	at net.i2p.i2ptunnel.TunnelController.startHttpBidirServer(TunnelController.java:494)
	at net.i2p.i2ptunnel.TunnelController.doStartTunnel(TunnelController.java:289)
	at net.i2p.i2ptunnel.TunnelController.startTunnel(TunnelController.java:232)
	at net.i2p.i2ptunnel.TunnelController$1.run(TunnelController.java:212)
	at java.lang.Thread.run(Thread.java:745)
	at net.i2p.util.I2PThread.run(I2PThread.java:107)
DEBUG [er str4d.i2p] tunnel.I2PTunnelHTTPBidirProxy: startup 0
java.lang.Exception: I did it
	at net.i2p.i2ptunnel.I2PTunnelClientBase.startup(I2PTunnelClientBase.java:521)
	at net.i2p.i2ptunnel.I2PTunnelClientBase.<init>(I2PTunnelClientBase.java:117)
	at net.i2p.i2ptunnel.I2PTunnelHTTPClientBase.<init>(I2PTunnelHTTPClientBase.java:150)
	at net.i2p.i2ptunnel.I2PTunnelHTTPClient.<init>(I2PTunnelHTTPClient.java:219)
	at net.i2p.i2ptunnel.I2PTunnelHTTPBidirProxy.<init>(I2PTunnelHTTPBidirProxy.java:40)
	at net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer.finishSetupI2PTunnelHTTPBidirServer(I2PTunnelHTTPBidirServer.java:35)
	at net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer.<init>(I2PTunnelHTTPBidirServer.java:21)
	at net.i2p.i2ptunnel.I2PTunnel.runHttpBidirServer(I2PTunnel.java:794)
	at net.i2p.i2ptunnel.TunnelController.startHttpBidirServer(TunnelController.java:494)
	at net.i2p.i2ptunnel.TunnelController.doStartTunnel(TunnelController.java:289)
	at net.i2p.i2ptunnel.TunnelController.startTunnel(TunnelController.java:232)
	at net.i2p.i2ptunnel.TunnelController$1.run(TunnelController.java:212)
	at java.lang.Thread.run(Thread.java:745)
	at net.i2p.util.I2PThread.run(I2PThread.java:107)
INFO  [er str4d.i2p] i2p.i2ptunnel.TunnelController: Client ready, listening on 127.0.0.1:4488
DEBUG [er str4d.i2p] tunnel.I2PTunnelHTTPBidirProxy: startup 0
java.lang.Exception: I did it
	at net.i2p.i2ptunnel.I2PTunnelClientBase.startup(I2PTunnelClientBase.java:521)
	at net.i2p.i2ptunnel.I2PTunnelClientBase.startRunning(I2PTunnelClientBase.java:516)
	at net.i2p.i2ptunnel.I2PTunnelHTTPClient.startRunning(I2PTunnelHTTPClient.java:313)
	at net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer.finishSetupI2PTunnelHTTPBidirServer(I2PTunnelHTTPBidirServer.java:36)
	at net.i2p.i2ptunnel.I2PTunnelHTTPBidirServer.<init>(I2PTunnelHTTPBidirServer.java:21)
	at net.i2p.i2ptunnel.I2PTunnel.runHttpBidirServer(I2PTunnel.java:794)
	at net.i2p.i2ptunnel.TunnelController.startHttpBidirServer(TunnelController.java:494)
	at net.i2p.i2ptunnel.TunnelController.doStartTunnel(TunnelController.java:289)
	at net.i2p.i2ptunnel.TunnelController.startTunnel(TunnelController.java:232)
	at net.i2p.i2ptunnel.TunnelController$1.run(TunnelController.java:212)
	at java.lang.Thread.run(Thread.java:745)
	at net.i2p.util.I2PThread.run(I2PThread.java:107)
INFO  [er str4d.i2p] i2p.i2ptunnel.TunnelController: Client ready, listening on 127.0.0.1:4488
ERROR [7.0.0.1:4488] tunnel.I2PTunnelHTTPBidirProxy: Error listening for connections on /127.0.0.1 port 4488
java.net.BindException: Address already in use
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
	at java.net.ServerSocket.bind(ServerSocket.java:376)
	at java.net.ServerSocket.<init>(ServerSocket.java:237)
	at net.i2p.i2ptunnel.I2PTunnelClientBase.run(I2PTunnelClientBase.java:688)
	at java.lang.Thread.run(Thread.java:745)
	at net.i2p.util.I2PThread.run(I2PThread.java:107)
INFO  [7.0.0.1:4488] i2p.i2ptunnel.TunnelController: Error listening for connections on /127.0.0.1 port 4488: java.net.BindException: Address already in use
INFO  [7.0.0.1:4488] tunnel.I2PTunnelHTTPBidirProxy: close() called: forced = true open = true sockMgr = net.i2p.client.streaming.impl.I2PSocketManagerFull@XXXX
INFO  [7.0.0.1:4488] i2p.i2ptunnel.TunnelController: Stopping client 4488 -> HTTPClient [NO PROXIES]
INFO  [er str4d.i2p] i2p.i2ptunnel.TunnelController: Ready!
INFO  [er str4d.i2p] i2p.i2ptunnel.TunnelController: Tunnels ready for server at 127.0.0.1:7658
INFO  [er str4d.i2p] net.i2p.i2ptunnel.I2PTunnel   : [3]:  adding task: Server at /127.0.0.1:7658
INFO  [er str4d.i2p] i2p.i2ptunnel.TunnelController: Acquiring session Session: XXXX[str4d.i2p #]: 
INFO  [er str4d.i2p] 2ptunnel.TunnelControllerGroup: Acquiring session Session: XXXX[str4d.i2p #]:  for TC httpbidirserver str4d.i2p for net.i2p.i2ptunnel.I2PTunnel@XXXX STARTING
WARN  [7.0.0.1:7658] unnel.I2PTunnelHTTPBidirServer: Starting executor with 65 threads max

comment:2 Changed 4 years ago by str4d

The culprit is d6cde6f0fb2d5adc41793eda0efb1f1550261fb4 (part of #815 work):

  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPBidirServer.java

    public class I2PTunnelHTTPBidirServer ex 
    3232        bidir = true;
    3333
    3434        /* start the httpclient */
    35         task = new I2PTunnelHTTPBidirProxy(localPort, l, sockMgr, getTunnel(), getEventDispatcher(), __serverId);
     35        I2PTunnelClientBase client = new I2PTunnelHTTPBidirProxy(localPort, l, sockMgr, getTunnel(), getEventDispatcher(), __serverId);
     36        client.startRunning();
     37        task = client;
    3638        sockMgr.setName("Server"); // TO-DO: Need to change this to "Bidir"!
    3739        getTunnel().addSession(sockMgr.getSession());
    3840        l.log("Ready!");
Last edited 4 years ago by str4d (previous) (diff)

comment:3 Changed 4 years ago by zzz

  • Component changed from router/general to apps/i2ptunnel
  • Milestone changed from undecided to 0.9.21

I broke it, and it was propped very early in this cycle, but apparently nobody tested it in 7 weeks.

Possibly affects IRC DCC client also, uncomfirmed.

comment:4 Changed 4 years ago by str4d

  • Status changed from new to testing

I'll take some of that blame, I should be testing -rc builds more.

Fix pushed in 034317df013b161a7f61b5617b37e6a20d4f3ef6 0.9.20-2, it fixes Seedless, have not tested IRC DCC.

comment:5 Changed 4 years ago by psi

making outbound dcc requests are non functional while recving inbound are functional on -2

comment:6 Changed 3 years ago by zzz

  • Resolution set to fixed
  • Status changed from testing to closed

presumed fixed

Note: See TracTickets for help on using tickets.