diff --git a/ChangeLog.d/bugfix/ZBX-16925 b/ChangeLog.d/bugfix/ZBX-16925
new file mode 100644
index 00000000000..7bb73300b45
--- /dev/null
+++ b/ChangeLog.d/bugfix/ZBX-16925
@@ -0,0 +1 @@
+........S. [ZBX-16925] fixed housekeeper behavior that blocked history sync and caused deadlocks when deleting events (vso)
diff --git a/src/zabbix_server/housekeeper/housekeeper_server.c b/src/zabbix_server/housekeeper/housekeeper_server.c
index c21121b6776..f2b84979ab3 100644
--- a/src/zabbix_server/housekeeper/housekeeper_server.c
+++ b/src/zabbix_server/housekeeper/housekeeper_server.c
@@ -72,6 +72,7 @@ typedef struct
 
 	/* a reference to the settings value specifying number of seconds the records must be kept */
 	int		*phistory;
+	char		*fk_table;
 }
 zbx_hk_rule_t;
 
@@ -835,6 +836,18 @@ static int	housekeeping_process_rule(int now, int config_max_hk_delete, zbx_hk_r
 					break;
 			}
 
+			zbx_db_begin();
+
+			if (NULL != rule->fk_table)
+			{
+				sql_offset = 0;
+				zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "delete from %s where",
+						rule->fk_table);
+				zbx_db_add_condition_alloc(&sql, &sql_alloc, &sql_offset, rule->field_name,
+						ids_uint64.values, ids_uint64.values_num);
+				zbx_db_execute("%s", sql);
+			}
+
 			sql_offset = 0;
 			zbx_snprintf_alloc(&sql, &sql_alloc, &sql_offset, "delete from %s where", rule->table);
 
@@ -856,6 +869,9 @@ static int	housekeeping_process_rule(int now, int config_max_hk_delete, zbx_hk_r
 			else
 				zbx_vector_str_clear_ext(&ids_str, zbx_str_free);
 
+			if (ZBX_DB_OK != zbx_db_commit())
+				break;
+
 			if (ZBX_DB_OK > ret)
 				break;
 
@@ -1134,7 +1150,7 @@ static int	housekeeping_sessions(int now, int config_max_hk_delete)
 static int	housekeeping_services(int now, int config_max_hk_delete)
 {
 	static zbx_hk_rule_t	rule = {"service_alarms", "servicealarmid", "", HK_MIN_CLOCK_UNDEFINED,
-			&cfg.hk.services_mode, &cfg.hk.services};
+			&cfg.hk.services_mode, &cfg.hk.services, NULL};
 
 	if (ZBX_HK_OPTION_ENABLED == cfg.hk.services_mode)
 		return housekeeping_process_rule(now, config_max_hk_delete, &rule);
@@ -1145,7 +1161,7 @@ static int	housekeeping_services(int now, int config_max_hk_delete)
 static int	housekeeping_audit(int now, int config_max_hk_delete)
 {
 	static zbx_hk_rule_t	rule = {"auditlog", "auditid", "", HK_MIN_CLOCK_UNDEFINED, &cfg.hk.audit_mode,
-			&cfg.hk.audit};
+			&cfg.hk.audit, NULL};
 
 	if (ZBX_HK_MODE_DISABLED != cfg.hk.audit_mode)
 		return housekeeping_process_rule(now, config_max_hk_delete, &rule);
@@ -1234,8 +1250,8 @@ static int	housekeeping_events(int now, int config_max_hk_delete)
 					")" \
 					" and not exists(" \
 						"select null" \
-						" from problem" \
-						" where events.eventid=problem.r_eventid" \
+						" from event_recovery" \
+						" where events.eventid=event_recovery.r_eventid" \
 					")"
 #define ZBX_HK_TRIGGER_EVENT_RULE	" and not exists(" \
 						"select null" \
@@ -1247,28 +1263,32 @@ static int	housekeeping_events(int now, int config_max_hk_delete)
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_TRIGGERS)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_TRIGGER)
 			ZBX_HK_EVENT_RULE ZBX_HK_TRIGGER_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK,
-			&cfg.hk.events_mode, &cfg.hk.events_trigger},
+			&cfg.hk.events_mode, &cfg.hk.events_trigger, "event_recovery"},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_INTERNAL)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_TRIGGER)
-			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_internal},
+			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_internal,
+			"event_recovery"},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_INTERNAL)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_ITEM)
-			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_internal},
+			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_internal,
+			"event_recovery"},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_INTERNAL)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_LLDRULE)
-			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_internal},
+			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_internal,
+			"event_recovery"},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_DISCOVERY)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_DHOST), HK_MIN_CLOCK_UNDEFINED, &cfg.hk.events_mode,
-			&cfg.hk.events_discovery},
+			&cfg.hk.events_discovery, NULL},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_DISCOVERY)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_DSERVICE), HK_MIN_CLOCK_UNDEFINED,
-			&cfg.hk.events_mode, &cfg.hk.events_discovery},
+			&cfg.hk.events_mode, &cfg.hk.events_discovery, NULL},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_AUTOREGISTRATION)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_ZABBIX_ACTIVE), HK_MIN_CLOCK_UNDEFINED,
-			&cfg.hk.events_mode, &cfg.hk.events_autoreg},
+			&cfg.hk.events_mode, &cfg.hk.events_autoreg, NULL},
 		{"events", "eventid", "events.source=" ZBX_STR(EVENT_SOURCE_SERVICE)
 			" and events.object=" ZBX_STR(EVENT_OBJECT_SERVICE)
-			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_service},
+			ZBX_HK_EVENT_RULE, HK_MIN_CLOCK_ALWAYS_RECHECK, &cfg.hk.events_mode, &cfg.hk.events_service,
+			"event_recovery"},
 		{0}
 	};
 
