question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Call execute throws SecurityException

See original GitHub issue

My app just crashed with the following exception:

Fatal Exception: java.lang.RuntimeException: An error occured while executing doInBackground()
       at android.os.AsyncTask$3.done(AsyncTask.java:304)
       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 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:818)
Caused by java.lang.SecurityException: Permission denied (missing INTERNET permission?)
       at java.net.InetAddress.lookupHostByName(InetAddress.java:451)
       at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
       at java.net.InetAddress.getAllByName(InetAddress.java:215)
       at okhttp3.Dns$1.lookup(Dns.java:39)
       at okhttp3.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:173)
       at okhttp3.internal.http.RouteSelector.nextProxy(RouteSelector.java:139)
       at okhttp3.internal.http.RouteSelector.next(RouteSelector.java:81)
       at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174)
       at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:127)
       at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
       at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:289)
       at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
       at okhttp3.RealCall.getResponse(RealCall.java:240)
       at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
       at okhttp3.RealCall.execute(RealCall.java:57)
       at com.myapp.test.Loader.doRequest(Loader.java:312)
       at com.myapp.test.Loader.request(Loader.java:283)
       at com.myapp.test.Loader.getResponse(Loader.java:164)
       at com.myapp.test.Loader.getResponse(Loader.java:136)
       at com.myapp.test.Loader.executeSynchronous(Loader.java:117)
       at com.myapp.test.Loader.access$500(Loader.java:40)
       at com.myapp.test.Loader$1.doInBackground(Loader.java:98)
       at com.myapp.test.Loader$1.doInBackground(Loader.java:93)
       at android.os.AsyncTask$2.call(AsyncTask.java:292)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       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:818)
Caused by android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
       at libcore.io.Posix.android_getaddrinfo(Posix.java)
       at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
       at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
       at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
       at java.net.InetAddress.getAllByName(InetAddress.java:215)
       at okhttp3.Dns$1.lookup(Dns.java:39)
       at okhttp3.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:173)
       at okhttp3.internal.http.RouteSelector.nextProxy(RouteSelector.java:139)
       at okhttp3.internal.http.RouteSelector.next(RouteSelector.java:81)
       at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174)
       at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:127)
       at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
       at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:289)
       at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
       at okhttp3.RealCall.getResponse(RealCall.java:240)
       at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
       at okhttp3.RealCall.execute(RealCall.java:57)
       at com.myapp.test.Loader.doRequest(Loader.java:312)
       at com.myapp.test.Loader.request(Loader.java:283)
       at com.myapp.test.Loader.getResponse(Loader.java:164)
       at com.myapp.test.Loader.getResponse(Loader.java:136)
       at com.myapp.test.Loader.executeSynchronous(Loader.java:117)
       at com.myapp.test.Loader.access$500(Loader.java:40)
       at com.myapp.test.Loader$1.doInBackground(Loader.java:98)
       at com.myapp.test.Loader$1.doInBackground(Loader.java:93)
       at android.os.AsyncTask$2.call(AsyncTask.java:292)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       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:818)
Caused by android.system.ErrnoException: android_getaddrinfo failed: EACCES (Permission denied)
       at libcore.io.Posix.android_getaddrinfo(Posix.java)
       at libcore.io.ForwardingOs.android_getaddrinfo(ForwardingOs.java:55)
       at java.net.InetAddress.lookupHostByName(InetAddress.java:438)
       at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252)
       at java.net.InetAddress.getAllByName(InetAddress.java:215)
       at okhttp3.Dns$1.lookup(Dns.java:39)
       at okhttp3.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:173)
       at okhttp3.internal.http.RouteSelector.nextProxy(RouteSelector.java:139)
       at okhttp3.internal.http.RouteSelector.next(RouteSelector.java:81)
       at okhttp3.internal.http.StreamAllocation.findConnection(StreamAllocation.java:174)
       at okhttp3.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:127)
       at okhttp3.internal.http.StreamAllocation.newStream(StreamAllocation.java:97)
       at okhttp3.internal.http.HttpEngine.connect(HttpEngine.java:289)
       at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:241)
       at okhttp3.RealCall.getResponse(RealCall.java:240)
       at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
       at okhttp3.RealCall.execute(RealCall.java:57)
       at com.myapp.test.Loader.doRequest(Loader.java:312)
       at com.myapp.test.Loader.request(Loader.java:283)
       at com.myapp.test.Loader.getResponse(Loader.java:164)
       at com.myapp.test.Loader.getResponse(Loader.java:136)
       at com.myapp.test.Loader.executeSynchronous(Loader.java:117)
       at com.myapp.test.Loader.access$500(Loader.java:40)
       at com.myapp.test.Loader$1.doInBackground(Loader.java:98)
       at com.myapp.test.Loader$1.doInBackground(Loader.java:93)
       at android.os.AsyncTask$2.call(AsyncTask.java:292)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       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:818)

At least, it should be documented that execute() can throw a security exception if someone removes the internet permission from the app with root.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
auchricommented, Feb 8, 2016

@philipgiuliani As you can see in my stacktrace, I’m using OkHttp 3 - so it’s not fixed.

2reactions
philipgiulianicommented, Feb 8, 2016

@istima this is already fixed in OkHttp 3.0!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SecurityException: Caller no longer running - Stack Overflow
1 Answer 1 · 5. GenericWorkItem is a protected class. · 3. Same issue. · i assume that you have not created a...
Read more >
SecurityException - Android Developers
This exception is thrown by the AccessController to indicate that a requested access (to a critical system resource such as the file system...
Read more >
How to solve SecurityException - Examples Java Code Geeks
The SecurityException indicates that a security violation has occurred an thus, the application cannot be executed. A simple example is to use a ......
Read more >
SecurityManager (Java SE 16 & JDK 16) - Oracle Help Center
Throws a SecurityException if the calling thread is not allowed to create a new class loader. This method calls checkPermission with the RuntimePermission(" ......
Read more >
Realme 3 Pro : Error : java.lang.SecurityException: Permission ...
I am getting below error when try to automate calculator or Amazon app in my Real device(Realme 3 Pro) with USB debugging mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found