Question

I have a swing application that freezes after some (random) time. I have taken 5 thread snapshots every 10 seconds after it freezes and they all contain these exact same lines:

"AWT-EventQueue-0" prio=6 tid=0x0000000009949000 nid=0x7bec waiting on condition [0x000000000ebbc000]
  java.lang.Thread.State: RUNNABLE
      at java.math.BigInteger.valueOf(Unknown Source)
      at java.math.BigDecimal.inflate(Unknown Source)
      at java.math.BigDecimal.add(Unknown Source)
      at uk.co.xx.xxx.xxxx.XXX$4.get(XXX.java:171)

Note that no other thread in the thread dump is in XXX.java. The corresponding code line (XXX.java:171) looks somewhat inoffensive:

a = a.add(b.multiply(c, MATH_CONTEXT), MATH_CONTEXT);

where:

  • a, b and c are local BigDecimal variables.
  • MATH_CONTEXT is a public final static variable, only accessed within XXX.java

My questions (answering any of them would be great help)

  • Is this evidence of a deadlock or liveness issue (the thread does not seem to make progress but it is in RUNNABLE state)?
  • Is this the likely reason for the freeze or should I look somewhere else?
  • What would be the next step to solve the problem?
Était-ce utile?

La solution

Is this evidence of a deadlock or liveness issue (the thread does not seem to make progress but it is in RUNNABLE state)?

I doubt it. Since the program freezes, there clearly is an issue. However, I doubt there's a deadlock involving the code you've shown.

Is this the likely reason for the freeze or should I look somewhere else?

I think it's likely that this is a red herring, and the problem lies elsewhere.

What would be the next step to solve the problem?

I personally would look into potential memory allocation and garbage collection issues. In particular, I would make sure the program isn't spending all of its time collecting garbage and therefore failing to make progress.

To do this, I'd use a memory profiler.

While I am at it, I would also monitor the overall CPU and memory usage of the process, and page fault statistics (to see if there's excessive swapping).

Autres conseils

I do no see a solution, but i can describe the steps i would start with.

I would try to attache a Profiler and check, whether the memory is growing, because the system could swap memory and that why it seems to hang, but i does not.

The profiler also tells you, if the Thread is really hanging and if so, where it seem to hang.

For profiling i use VisualVM.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top