stealthcopter / AndroidNetworkTools

Set of useful android network tools
Apache License 2.0
1.39k stars 282 forks source link

SubnetDevices.java - IllegalAccessError #79

Open grolschie opened 3 years ago

grolschie commented 3 years ago

Hi. I have seen this error on 2 devices so far, one actual device running Android 10 with over 5GB RAM (showing in Android Vitals) and one test device running Android 5 with 2GB RAM (showing in Pre-launch Reports).

FATAL EXCEPTION: AsyncTask #3
Process: [redacted] PID: 21041
java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:300)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.IllegalAccessError: Could not access local ip address
    at com.stealthcopter.networktools.SubnetDevices.fromLocalAddress(SubnetDevices.java:47)

I'm not really sure what to do about this, besides just catching it. (And yes, at some stage I plan to move away from AsyncTask.)

Your thoughts please? I'm not seeing anything relating to being out of memory.

grolschie commented 3 years ago

Is this project dead?

stealthcopter commented 3 years ago

@grolschie It's not quite dead, but my day job has switched away from Android development so work on this has taken a back seat. This library is still used in some of my apps, so I will likely still make infrequent updates. I welcome pull requests with fixes and improvements though.

For this error, it looks like it's just failing because no IPv4 addresses are found. It's not ideal for the library to handle it like this, but a try/catch should suffice for now.

grolschie commented 3 years ago

Thank you for that. Understood. 👍

After posting this I'm catching that exception as well as reducing the number of threads to 128. And I haven't seen the error since (obviously). So is the reduction of threads unnecessary? 256 is ok?

By the way, thanks for this library. It was a real lifesaver for me!

eksencncozay commented 2 years ago

Hi. I have seen this error on 2 devices so far, one actual device running Android 10 with over 5GB RAM (showing in Android Vitals) and one test device running Android 5 with 2GB RAM (showing in Pre-launch Reports).

FATAL EXCEPTION: AsyncTask #3
Process: [redacted] PID: 21041
java.lang.RuntimeException: An error occured while executing doInBackground()
  at android.os.AsyncTask$3.done(AsyncTask.java:300)
  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
  at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
  at java.util.concurrent.FutureTask.run(FutureTask.java:242)
  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
  at java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.IllegalAccessError: Could not access local ip address
  at com.stealthcopter.networktools.SubnetDevices.fromLocalAddress(SubnetDevices.java:47)

I'm not really sure what to do about this, besides just catching it. (And yes, at some stage I plan to move away from AsyncTask.)

Your thoughts please? I'm not seeing anything relating to being out of memory.

grolschie commented 2 years ago

Try setting the number of threads to 128. According to the readme file, the default is 255 for this tool. I haven't had the problem since doing this. You may have to wait just a little longer for the results.