zac unr command can cause SQL database deadlock

  • 7012580
  • 07-Jun-2013
  • 29-Dec-2014

Environment

Novell ZENworks Configuration Management 11.2

Situation

zac unr command is being issued so the device object should get deleted in the zone while agent refresh is going

SQL database gets into deadlock status

Resolution

This issue has been reviewed by Novell Engineering and is not found to be common. zac unr should not be executed at times the ZCM agent refresh is running to prevent this issue from occurring.

Cause

The zac unr command (if not launched with command line option -s) does trigger a device object removal in the database zZenObject table. The related delete SQL statement will cascade through many different other tables containing device related information including the zDevice table. If at about the same time a (timed) agent refresh is going, the agent refresh is calling the registration servlet which will update device related tables, foremost the zDevice table, with device's registration information.

These two operations can not update and delete the same entries in the same table at the very same time which can cause this deadlock situation on the SQL database related to this specific device on which zac unr is being executed.

Additional Information

One use case, where such an issue can be occurring with higher probability, is that relative to device startup a script is executed on a managed device, which should enforce rule-based imaging on next imaging boot-up.

A way to enforce rule-based imaging is to remove ZISD information (e.g. by running %zenworks_home%\bin\preboot\ziswin.exe -w) and call zac unr on a specific device. On the next imaging boot-up, rule-based imaging will be applied.  Clearing ZISD indicates that the device is not managed by a ZENworks setup. Additionally the imaging service verifies that there is not still an existing device object with same serial number or MAC address to ensure that it's not just ZISD information that is missing from the device.

Since an agent refresh is started relative to ZCM agent service startup (adding the configured delay for the Random Time to Wait value if configured), this can quite easily coincide with a script script being launched relative to device startup which call zac unr. Please note this initial agent refresh is also getting triggered if agent refresh has been configured to manual instead of timed refresh.