Wednesday, 2 September 2020

What could cause intermittent 'Permissions Denied' errors in DatagramChannel connect() calls on Android?

I'm seeing intermittent error reports from my end users' devices like:

java.net.ConnectException: Permission denied
    at sun.nio.ch.Net.connect0(Net.java)
    at sun.nio.ch.Net.connect(Net.java:466)
    at sun.nio.ch.DatagramChannelImpl.connect(DatagramChannelImpl.java:759)
    at tech.httptoolkit.android.vpn.SessionManager.createNewUDPSession(SessionManager.java:159)

That last line is here: https://github.com/httptoolkit/httptoolkit-android/blob/2d514dce3079d23b7a500580b202ae4f7767eaaa/app/src/main/java/tech/httptoolkit/android/vpn/SessionManager.java#L152.

The application does already request INTERNET permission, and connections do work in general, they just fail like this intermittently.

I don't have much more information on the exact request that's failing, and I can't easily reproduce the issue myself for testing, so I'm debugging blind.

What are the possible causes of this error?



from What could cause intermittent 'Permissions Denied' errors in DatagramChannel connect() calls on Android?

No comments:

Post a Comment