Files
open-webui/backend/open_webui
Classic298 601e0e4345 fix: stop tracking tasks under an empty item id (#29980)
An authenticated socket client can grow Open WebUI's memory without bound by sending ydoc updates for an empty document id. create_task files every task under item_tasks[id] whatever the id, while cleanup_task removes it only for a truthy id, so each update leaves a uuid behind for the process lifetime. normalize_document_id passes an empty id through, and such an id also skips the note access check.

create_task now files the task only when an id is provided, which is what its own comment already described and what the rest of the file does: redis_save_task and redis_cleanup_task both guard on a truthy item id, and stop_task normalizes a falsy one away. Nothing is filed, so nothing leaks, and cleanup_task's existing guard correctly no-ops.

This also settles a disagreement between the two backends. For an empty id, list_task_ids_by_item_id, has_active_tasks and stop_item_tasks answered one way with Redis and another without it; they now match. The visible consequence is that an instance without Redis no longer cancels a pending save for an empty document id, which is how Redis instances already behaved.

Measured over 300 calls with an empty id: 300 stale entries before, none after. Behaviour for a normal id is unchanged, including ordering, cancellation and key removal when the last task finishes.
2026-09-13 20:28:54 -05:00
..
2026-09-06 17:13:32 -04:00
2026-08-25 16:53:53 -04:00
2026-09-12 20:09:21 -04:00
2026-09-06 17:27:30 -04:00
2026-09-06 17:13:32 -04:00
2026-09-08 23:18:48 -04:00
2026-08-29 16:14:32 -04:00
2026-09-09 12:51:59 -04:00
2026-08-16 23:21:00 -07:00
2026-09-06 19:36:17 -04:00