Opened 7 weeks ago

Last modified 7 weeks ago

#2688 new defect

router.dispatchThreaded=true causes endless NPEs

Reported by: Reportage Owned by:
Priority: maintenance Milestone: undecided
Component: router/general Version: 0.9.44
Keywords: NPE, config, obscure Cc:
Parent Tickets: Sensitive: no


Steps to reproduce:
1) Enable router.dispatchThreaded=true in router.config
2) Restart router
3) Marvel at the torrent of NPEs in the logs


Change History (3)

comment:1 Changed 7 weeks ago by zzz

Priority: minormaintenance
Status: newinfoneeded_new

please provide a single sample stack trace out of the torrent

comment:2 Changed 7 weeks ago by Reportage

Status: infoneeded_newnew
CRIT [… Dispatcher] …InNetMessagePool: Error in the Tunnel Data Dispatcher

Enabling net.i2p.router.tunnel.TunnelDispatcher?=DEBUG doesn't provide further information

comment:3 Changed 7 weeks ago by zzz

OK I see the issue.

There's three possible cases that might work:
DISPATCH_DIRECT=true (default, unqueued)
DISPATCH_DIRECT=false with router.dispatchThreaded=false (job queue)
DISPATCH_DIRECT=false with router.dispatchThreaded=true (INMP queue)

The fourth case,
DISPATCH_DIRECT=true with router.dispatchThreaded=true
will never work, it NPEs all over as reported by OP. But DISPATCH_DIRECT is hardcoded to true.

jrandom added hardcoded DISPATCH_DIRECT=true in April 2005.

The flavors with DISPATCH_DIRECT=false have bitrotted, they use old Java 4 synchronized ArrayList? queues, haven't even been updated for Java 5 queues, and certainly haven't been tested in 15 years.

jrandom's 2005 change looks correct here, we don't need more queues and threads here in INMP, or putting every message on the JobQueue?. Jogger would probably agree, he doesn't like more context switches. Having inbound messages "push through" to the outbound side has caused some deadlock issues through the years, but I think we have them all fixed.

At this point the right thing to do would be to rip out all the code for DISPATCH_DIRECT=false and the router.dispatchThreaded option in INMP.

Note: See TracTickets for help on using tickets.