Doing bulk ack from Problems page to close all problems, tasks are added to database and processed by task manager.
In case if we ack a lot problems it is possible that related events will be deleted by housekeeper and when task manager will try to process it, it will fail.
result = DBselect("select a.userid,a.eventid,e.objectid"
" from task_close_problem tcp,acknowledges a"
" left join events e"
" on a.eventid=e.eventid"
" where tcp.taskid=" ZBX_FS_UI64
" and tcp.acknowledgeid=a.acknowledgeid",
if (NULL != (row = DBfetch(result)))
If query output IS NULL
28067:20170619:003615.086 query [txnlev:0] [select a.userid,a.eventid,e.objectid from task_close_problem tcp,acknowledges a left join events e on a.eventid=e.eventid where tcp.taskid=123865 and tcp.acknowledgeid=a.acknowledgeid]
28067:20170619:003615.087 End of tm_try_task_close_problem():FAIL
And these tasks remain in database.