portmapper icon indicating copy to clipboard operation
portmapper copied to clipboard

Caused by java.net.ConnectException

Open jefryjacky opened this issue 6 years ago • 8 comments

keep crashing my android app, below is the exception

Fatal Exception: java.lang.RuntimeException java.net.ConnectException: failed to connect to /fe80::12be:f5ff:fe1a:d414 (port 49152): connect failed: EINVAL (Invalid argument) com.offbynull.portmapper.gateways.network.NetworkRunnable.run (SourceFile:134) java.lang.Thread.run (Thread.java:818)

Caused by java.net.ConnectException failed to connect to /fe80::12be:f5ff:fe1a:d414 (port 49152): connect failed: EINVAL (Invalid argument) libcore.io.IoBridge.connect (IoBridge.java:124) arrow_drop_down java.nio.SocketChannelImpl.connect (SocketChannelImpl.java:199) com.offbynull.portmapper.gateways.network.NetworkRunnable.processMessage (SourceFile:366) com.offbynull.portmapper.gateways.network.NetworkRunnable.run (SourceFile:127) java.lang.Thread.run (Thread.java:818)

Caused by android.system.ErrnoException connect failed: EINVAL (Invalid argument) libcore.io.Posix.connect (Posix.java) libcore.io.BlockGuardOs.connect (BlockGuardOs.java:111) libcore.io.IoBridge.connectErrno (IoBridge.java:137) libcore.io.IoBridge.connect (IoBridge.java:122) libcore.io.IoBridge.connect (IoBridge.java:110) java.nio.SocketChannelImpl.connect (SocketChannelImpl.java:199) arrow_right com.offbynull.portmapper.gateways.network.NetworkRunnable.processMessage (SourceFile:366) com.offbynull.portmapper.gateways.network.NetworkRunnable.run (SourceFile:127) java.lang.Thread.run (Thread.java:818)

jefryjacky avatar Apr 17 '18 05:04 jefryjacky

This looks like a core OS error. What phone maker/model? What version of Android?

Do you have logs? You need to add in an android logger for slf4j and enable trace logging.

offbynull avatar Apr 17 '18 13:04 offbynull

Hi, The crash is at NetworkRunnable class line 366 ==> channel.connect(dst);

Crash happened on this phone:

  1. phone model: asus ZenFone 2 (ZE550ML) OS: Android 5.0

  2. phone model: Huawei Nexus 6P OS: Android 8.0.0

I have tested it on Samsung Galaxy Duos Android 4.2.2 and Emulator Android 8.0.0, it's not crashing my app.

I don't have a log for this issue now.

jefryjacky avatar Apr 18 '18 15:04 jefryjacky

I can wrap the connect call in a try/catch and have it ignore errors, but there's probably something wrong with how the Android build was set up or how the parsing of OS commands is happening. If you can get logs, it would help me with finding what the core issue is.

offbynull avatar Apr 19 '18 13:04 offbynull

Ok, I will get the log for you later.

jefryjacky avatar Apr 19 '18 16:04 jefryjacky

Hi @offbynull ,

Here is the log, Log nexus.txt

jefryjacky avatar Apr 23 '18 03:04 jefryjacky

Thanks. I'll take a look at this shortly.

offbynull avatar Apr 23 '18 13:04 offbynull

did you find the problem

foralllove avatar Mar 17 '20 06:03 foralllove

It's hard to narrow down without access to the device. If you're encountering problems, your best bet is to debug it and submit a patch. I don't have as much free time anymore to put into this project.

offbynull avatar Mar 20 '20 11:03 offbynull