[ZBX-8510] Possible lock between delete/create IT services methods Created: 2014 Jul 22  Updated: 2017 May 30  Resolved: 2014 Aug 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 2.0.12, 2.2.5
Fix Version/s: 2.2.6rc1, 2.3.4

Type: Incident report Priority: Major
Reporter: Alexey Pustovalov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: deadlock, itservices, lock
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-8586 Saving an IT service takes very long Closed

 Description   

It happens because of Zabbix does not sort rows before update/delete. For example:

SQL (0.000334): UPDATE services SET status='0' WHERE serviceid='330'
CAPIObject->delete() -> CAPIObject->__call() -> czbxrpc::call() -> czbxrpc::callAPI() -> call_user_func() -> CService->delete() -> update_services_status_all() -> update_services_rec() -> update_services_rec() -> DBexecute()
SQL (0.000292): UPDATE services SET status='0' WHERE serviceid='325'
CAPIObject->delete() -> CAPIObject->__call() -> czbxrpc::call() -> czbxrpc::callAPI() -> call_user_func() -> CService->delete() -> update_services_status_all() -> update_services_rec() -> update_services_rec() -> update_services_rec() -> DBexecute()
SQL (0.000444): UPDATE services SET status='0' WHERE serviceid='1355'
CAPIObject->delete() -> CAPIObject->__call() -> czbxrpc::call() -> czbxrpc::callAPI() -> call_user_func() -> CService->delete() -> update_services_status_all() -> update_services_rec() -> DBexecute()
SQL (0.000305): UPDATE services SET status='0' WHERE serviceid='1301'
CAPIObject->delete() -> CAPIObject->__call() -> czbxrpc::call() -> czbxrpc::callAPI() -> call_user_func() -> CService->delete() -> update_services_status_all() -> update_services_rec() -> update_services_rec() -> DBexecute()

The behavior can cause to deadlocks and locks



 Comments   
Comment by Alexander Vladishev [ 2014 Aug 04 ]

Available in development branch svn://svn.zabbix.com/branches/dev/ZBX-8510

Comment by Pavels Jelisejevs (Inactive) [ 2014 Aug 05 ]

(1) I've refactored the calculateITServiceStatus() function and covered it with unit tests. Additionally I've fixed a bug: when you have an IT service with "all children" algorithm, it was set to the lowest severity of it's child services instead of the highest.

Made some minor coding style fixes in r47816.

sasha CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2014 Aug 05 ]

(2) I've removed the unused get_service_status() function in r47815.

sasha CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2014 Aug 05 ]

(3) I've refactored the trigger API to only update IT services when updating a trigger which is linked to an IT service in r47818.

sasha CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2014 Aug 06 ]

Fixed in 2.2.6rc1 r47847 and 2.3.4 r47850.

Comment by Pavels Jelisejevs (Inactive) [ 2014 Aug 06 ]

CLOSED.

Comment by richlv [ 2014 Aug 08 ]

(4) string changes

jelisejev None. CLOSED.

<richlv>

> svn diff -c 47847 frontends/php/include/services.inc.php | grep Unknown
-                       error(_('Unknown calculation algorithm of service status').SPACE.'['.$algorithm.']');

REOPENED

sasha Thanks!

Removed:

  • Unknown calculation algorithm of service status

CLOSED

Generated at Thu Apr 25 18:13:48 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.