Bug #244

Deadlock when reset dongle fails

Added by Stefano Lenzi over 3 years ago. Updated about 3 years ago.

Status:Closed Start date:07/08/2014
Priority:High Due date:
Assignee:Stefano Lenzi % Done:

0%

Category:zigbee.CC2530.driver Spent time: -
Target version:org.aaloa.zb4osgi.zigbee.CC2530.driver-0.3.0
Has a patch:No Has license agreement signed:No

Description

I had a deadlock, with a thread waiting to be woken up while waiting for the network to become ready in DriverCC2530.waitForNetwork()

The driver was in state
NETWORK_INITIALIZING
so when SimpleDriver calls its close() method (as the reset failed),
setState(DriverStatus.CLOSED);
is never called, and the waiting thread not notified (so it keeps on waiting for ever).

To fix, I suggest:
1. make DriverStatus volatile. It seems its access is not correctly synchronized.
2. in DriverCC2530.close()
remove the if condition around
if(state == DriverStatus.CREATED){
setState(DriverStatus.CLOSED);
}
So that setState(CLOSED) gets called in every case (and all waiting threads get notified)

Relevant stack trace:
"FelixStartLevel" daemon prio=10 tid=0xb6772288 nid=0xb1a in Object.wait() [0xa9fae000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0xac8d2328> (a it.cnr.isti.zigbee.dongle.CC2530.impl.DriverCC2530)
at java.lang.Object.wait(Object.java:503)
at it.cnr.isti.zigbee.dongle.CC2530.impl.DriverCC2530.waitForNetwork(DriverCC2530.java:783)
- locked <0xac8d2328> (a it.cnr.isti.zigbee.dongle.CC2530.impl.DriverCC2530)
at it.cnr.isti.zigbee.dongle.CC2530.impl.DriverCC2530.sendAFRegister(DriverCC2530.java:1478)
at it.cnr.isti.zigbee.basedriver.communication.AFLayer.createEndPoint(AFLayer.java:182)

The other thread (SimpleDriver) ended as expected, so is not in the trace.


Related issues

related to Bug #248: The status of the driver mat not be clean if it fails to ... Closed 07/11/2014
related to Bug #249: status variable should be at least volatile for synchroni... Closed 07/11/2014
related to Improvement #251: The values of enum of the DriverStatus may affect the Dea... Closed 07/11/2014
related to Bug #245: Deadlock issue for EZ430_RF2480 Closed 07/08/2014

Associated revisions

Revision 1030
Added by Stefano Lenzi over 3 years ago

Trying to fix deadlock issue when the initialization of the network fails ( refs #244 )

History

#1 Updated by Stefano Lenzi over 3 years ago

  • Status changed from New to Feedback

I have patched both the CC2530 and ez430-rf2480 driver, can you please check if it works for you?

#2 Updated by Stefano Lenzi about 3 years ago

  • Status changed from Feedback to Closed
  • Target version changed from org.aaloa.zb4osgi.zigbee.CC2530.driver-1.X to org.aaloa.zb4osgi.zigbee.CC2530.driver-0.3.0

I will consider it as closed, please open it again if needed

Also available in: Atom PDF