the8472 / mldht

Bittorrent Mainline DHT implementation in java
Mozilla Public License 2.0
147 stars 45 forks source link

NullPointerException #7

Closed pierremonteux closed 7 years ago

pierremonteux commented 7 years ago

Cloned the repo, built (mvn package dependency:copy-dependencies appassembler:assemble) , created work directory,

executed daemon binary (../bin/mldht-daemon )

Listening for transport dt_socket at address: 10044 Exception in thread "main" java.lang.NullPointerException at lbms.plugins.mldht.kad.DHT.routerBootstrap(DHT.java:1026) at lbms.plugins.mldht.kad.DHT.bootstrap(DHT.java:996) at lbms.plugins.mldht.kad.DHT.started(DHT.java:758) at lbms.plugins.mldht.kad.DHT.start(DHT.java:736) at the8472.mldht.Launcher.start(Launcher.java:215) at the8472.mldht.Launcher.main(Launcher.java:298)

I've tested this on two different linux machines, using both openjdk8 and oracles java 8.

the8472 commented 7 years ago

Do you have IPv4+IPv6 on that server? If not then you must adjust the config.xml as mentioned in the readme

pierremonteux commented 7 years ago

I have tried the config.xml with the disable line both commented in and out. I've also tried it with all the commented out lines removed. No changes either way.

6

I do have ipv6 and 4 support.

wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 44:6d:57:5b:6c:18 brd ff:ff:ff:ff:ff:ff inet 192.168.10.37/24 brd 192.168.10.255 scope global dynamic wlp2s0 valid_lft 73689sec preferred_lft 73689sec inet6 fe80::214:4ed8:efb2:6c0c/64 scope link valid_lft forever preferred_lft forever

the8472 commented 7 years ago

inet6 fe80::214:4ed8:efb2:6c0c/64 scope link

That is a link-local ipv6 address, not publicly routable. But I'll look if I can make this more ergonomic.

pierremonteux commented 7 years ago

Just to try to be more verbose with the configurations I've tried, all of these result in the same error.

config.xml autocreated version config.autocreate.xml.txt

../bin/mldht-daemon Listening for transport dt_socket at address: 10045 Exception in thread "main" java.lang.NullPointerException at lbms.plugins.mldht.kad.DHT.routerBootstrap(DHT.java:1026) at lbms.plugins.mldht.kad.DHT.bootstrap(DHT.java:996) at lbms.plugins.mldht.kad.DHT.started(DHT.java:758) at lbms.plugins.mldht.kad.DHT.start(DHT.java:736) at the8472.mldht.Launcher.start(Launcher.java:215) at the8472.mldht.Launcher.main(Launcher.java:298)

config.xml with disableIPVersion 6 /disableIPVersion commented back in config.commentedin.xml.txt

Listening for transport dt_socket at address: 10045 Exception in thread "main" java.lang.NullPointerException at lbms.plugins.mldht.kad.DHT.routerBootstrap(DHT.java:1026) at lbms.plugins.mldht.kad.DHT.bootstrap(DHT.java:996) at lbms.plugins.mldht.kad.DHT.started(DHT.java:758) at lbms.plugins.mldht.kad.DHT.start(DHT.java:736) at the8472.mldht.Launcher.start(Launcher.java:215) at the8472.mldht.Launcher.main(Launcher.java:298)

config.xml with everything commented back in config.everythingcommentedin.xml.txt

Listening for transport dt_socket at address: 10045 Exception in thread "main" java.lang.NullPointerException at lbms.plugins.mldht.kad.DHT.routerBootstrap(DHT.java:1026) at lbms.plugins.mldht.kad.DHT.bootstrap(DHT.java:996) at lbms.plugins.mldht.kad.DHT.started(DHT.java:758) at lbms.plugins.mldht.kad.DHT.start(DHT.java:736) at the8472.mldht.Launcher.start(Launcher.java:215) at the8472.mldht.Launcher.main(Launcher.java:298) all three versions attached.

the8472 commented 7 years ago

try a7cf9e02514efa036ea4d78faf1268eb43b8d456 it will write more informative messages to the log now.

pierremonteux commented 7 years ago

That helped a lot.

Running the initial run in a clean work directory resulted in:

java.net.SocketException: Network is unreachable at sun.nio.ch.Net.connect0(Native Method) at sun.nio.ch.Net.connect(Net.java:454) at sun.nio.ch.DatagramChannelImpl.connect(DatagramChannelImpl.java:727) at lbms.plugins.mldht.kad.utils.AddressUtils.getDefaultRoute(AddressUtils.java:205) at lbms.plugins.mldht.kad.DHT.start(DHT.java:740) at the8472.mldht.Launcher.start(Launcher.java:215) at the8472.mldht.Launcher.main(Launcher.java:298)

Which I assume is expected without IPV6 support out to the router. The interesting thing is this time the process did not die immediately like it did before.

Changing the autocreated config.xml file to disable IPV6 resulted in

Listening for transport dt_socket at address: 10044

I checked out the version before this commit, and with the same configuration it still failed with the crash above. So this definitely fixed this issue. Thanks for the help. :+1:

the8472 commented 7 years ago

Feel free to make a new issue if you have new questions.