51

When debugging in Android Studio, in certain scenarios the app crashes with following exception:

08-27 18:01:25.144  19241-24656/? E/AndroidRuntime﹕ FATAL EXCEPTION: pool-7-thread-1
Process: com.callsign.android.dev, PID: 19241
java.lang.InterruptedException
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:1991)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2025)
        at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
        at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:820)

This happens

  • only when debugging
  • only on certain devices (i.e. Moto G, Nexus 4)

It does not happen on Oneplus One or Xperia L for example.

I haven't found any other information to help us identify the problem. Anybody else running into this issue?

Marcel Bro
  • 4,907
  • 4
  • 43
  • 70

3 Answers3

0

Try Async Task or for your part of code. "AbstractQueuedSynchronizer" looks Synchronizing problem.

public class Task extends AsyncTask<Void, Void, Void>
    {
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
        }

        protected Void doInBackground(Void... paths) {
            //here your code (approx from line 400 to 850)
           return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
        }
    }

for call Task on button click or from any other method

new Task().execute();
Sagar Makhija
  • 863
  • 8
  • 9
0

This might help you, Set a breakpoint at the method Thread::interrupt and catch the offender. For more information, Link can help.

Or share some detailed code snippets. it depends on your code requirement and what you are doing and how.

Anant Shah
  • 3,744
  • 1
  • 35
  • 48
0
  1. Examine your codebase, especially parts that involve multithreading or background tasks. Pay close attention to areas where threads are used, and make sure that proper synchronization mechanisms, such as locks or semaphores, are in place to prevent conflicts.

  2. Analyze if there's anything in your debugging process that might be triggering the issue. Sometimes, breakpoints, watches, or evaluations of complex expressions can have unintended consequences, causing the app to behave differently when debugging compared to normal execution.

I think these might be the culprit, pay attention to those, and sometimes build.gradle configurations also cause the issue, with some libraries.

Happy coding :)

Abdul Aziz
  • 442
  • 5
  • 12