Opened 12 months ago

Last modified 10 months ago

#2303 open defect

Snark does not restart clean on OSX High Sierra

Reported by: jogger Owned by: zzz
Priority: major Milestone: undecided
Component: apps/i2psnark Version: 0.9.36
Keywords: Cc:
Parent Tickets: Sensitive: no

Description

On every restart of the router Snark first comes up with "Error connecting to I2P - check your I2CP settings" and then performs a full rescan of all torrents. They reside within the root directory of a SD Card (HFS extended journaled), takes more than an hour.

Bug present with Java 9 and 10 as well as previous i2p versions.

Corresponding error messages in the router log:

28.08.18, 08:46:04 ↓↓↓ 7 similar messages omitted ↓↓↓
28.08.18, 08:46:04 ERROR 1/1? r.transport.ntcp.NTCPTransport: Error listening

java.net.BindException?: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl?.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor?.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor?.bind(Unknown Source)
at net.i2p.router.transport.ntcp.NTCPTransport.bindAddress(NTCPTransport.java:967)
at net.i2p.router.transport.ntcp.NTCPTransport.restartListening(NTCPTransport.java:856)
at net.i2p.router.transport.ntcp.NTCPTransport.externalAddressReceived(NTCPTransport.java:1570)
at net.i2p.router.transport.ntcp.NTCPTransport.externalAddressReceived(NTCPTransport.java:1386)
at net.i2p.router.transport.TransportManager?.externalAddressReceived(TransportManager?.java:288)
at net.i2p.router.transport.CommSystemFacadeImpl?.notifyReplaceAddress(CommSystemFacadeImpl?.java:278)
at net.i2p.router.transport.udp.UDPTransport.replaceAddress(UDPTransport.java:2367)
at net.i2p.router.transport.udp.UDPTransport.locked_rebuildExternalAddress(UDPTransport.java:2290)
at net.i2p.router.transport.udp.UDPTransport.rebuildExternalAddress(UDPTransport.java:2183)
at net.i2p.router.transport.udp.UDPTransport.startup(UDPTransport.java:558)
at net.i2p.router.transport.udp.UDPTransport.startListening(UDPTransport.java:2020)
at net.i2p.router.transport.TransportManager?.startListening(TransportManager?.java:345)
at net.i2p.router.transport.CommSystemFacadeImpl?.startup(CommSystemFacadeImpl?.java:63)
at net.i2p.router.startup.BootCommSystemJob?.runJob(BootCommSystemJob?.java:44)
at net.i2p.router.JobQueueRunner?.runCurrentJob(JobQueueRunner?.java:135)
at net.i2p.router.JobQueueRunner?.run(JobQueueRunner?.java:78)

28.08.18, 08:46:03 ↓↓↓ 11 similar messages omitted ↓↓↓
28.08.18, 08:46:03 ERROR [k DirMonitor?] eaming.I2PSocketManagerFactory: Error creating session for socket manager

net.i2p.client.I2PSessionException: No manager yet
at net.i2p.router.client.ClientManagerFacadeImpl?.connect(ClientManagerFacadeImpl?.java:266)
at net.i2p.client.impl.I2PSessionImpl.connect(I2PSessionImpl.java:614)
at net.i2p.client.streaming.I2PSocketManagerFactory.createManager(I2PSocketManagerFactory.java:247)
at net.i2p.client.streaming.I2PSocketManagerFactory.createManager(I2PSocketManagerFactory.java:167)
at net.i2p.client.streaming.I2PSocketManagerFactory.createManager(I2PSocketManagerFactory.java:108)
at org.klomp.snark.I2PSnarkUtil.connect(I2PSnarkUtil.java:270)
at org.klomp.snark.SnarkManager?.monitorTorrents(SnarkManager?.java:2631)
at org.klomp.snark.SnarkManager?.access$1200(SnarkManager?.java:58)
at org.klomp.snark.SnarkManager?$DirMonitor?.run(SnarkManager?.java:2419)
at java.base/java.lang.Thread.run(Unknown Source)
at net.i2p.util.I2PThread.run(I2PThread.java:103)

28.08.18, 08:46:03 ERROR 1/1? r.transport.ntcp.NTCPTransport: Error listening

java.net.BindException?: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.Net.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketChannelImpl?.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor?.bind(Unknown Source)
at java.base/sun.nio.ch.ServerSocketAdaptor?.bind(Unknown Source)
at net.i2p.router.transport.ntcp.NTCPTransport.bindAddress(NTCPTransport.java:967)
at net.i2p.router.transport.ntcp.NTCPTransport.startListening(NTCPTransport.java:800)
at net.i2p.router.transport.TransportManager?.startListening(TransportManager?.java:345)
at net.i2p.router.transport.CommSystemFacadeImpl?.startup(CommSystemFacadeImpl?.java:63)
at net.i2p.router.startup.BootCommSystemJob?.runJob(BootCommSystemJob?.java:44)
at net.i2p.router.JobQueueRunner?.runCurrentJob(JobQueueRunner?.java:135)
at net.i2p.router.JobQueueRunner?.run(JobQueueRunner?.java:78)

Subtickets

Change History (4)

comment:1 Changed 11 months ago by zzz

Status: newopen

Not sure what's going on here - the first and third errors are about the NTCP port being in use - either you have another router with the same port running, or some other program, or something similar went wrong.

The error connecting to i2p - which is the second traceback above - is a side-effect of not being about to build any tunnels, probably because of the duplicate port issue.

But why that causes a full rescan of all the torrents, I don't know. This will be a bit of trouble to figure out.

comment:2 Changed 10 months ago by jogger

With respect to the second error message: I think this comes up, because Snark is still busy scanning torrents and has not opened a tunnel.

I verified on Linux and MacOS that the rescanning of torrents is related to some old closed bug I could not find anymore. This occurs when shutting down with no participating tunnels. For me this is really bad because this means I can not safely shut down an IPv6-only router as those usually do not build any participating tunnels at all.

comment:3 Changed 10 months ago by zzz

Try increasing wrapper.restart.delay in wrapper.config to 30 or 60 seconds, to give the OS more time to clear out the old sockets.

Complete i2p shutdown and then start (not restart) required to pick up the wrapper.config changes.

comment:4 Changed 10 months ago by jogger

Followed your advice, first and third error disappeared, second remained.

Nailed it down to the Snark startup delay. Second error occurs when set to 0, not when set to 60 sec. Machine is a fast Quadcore i7 Mac Mini, running latest High Sierra with Java 10.0.2 which is shipped as default. Seems Snark is starting faster than some network components get ready.

Note: See TracTickets for help on using tickets.