mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-15 21:19:39 -05:00
[PR #16734] UPD: Enable ExceptionGroup catching in tasks.py & handler in main.py #11018
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/16734
Author: @rgaricano
Created: 8/19/2025
Status: 🔄 Open
Base:
dev← Head:dev-Catch_ExceptionGroup📝 Commits (6)
631d444UPD: ExceptionGroup catch in tasks.pyaa5f533UPD: ExceptionGroup catch - update main.py8a423c0Fix Format Code Warmings5fdb68bFix Code Format Warmingsbd883c8Fix Code Format Warmingbeb7b0bre-add "from the globaltasksdictionary" comment that was removed📊 Changes
2 files changed (+69 additions, -12 deletions)
View changed files
📝
backend/open_webui/main.py(+14 -1)📝
backend/open_webui/tasks.py(+55 -11)📄 Description
Implementation of ExceptionGroup catching as commented in https://github.com/open-webui/open-webui/discussions/16732#discussioncomment-14155085
In some scenarios with concurrent tasks, for example when uploading files (e.g. issue https://github.com/open-webui/open-webui/discussions/16964), multiple tasks may fail simultaneously, resulting in "ExceptionGroup: Unhandled errors in a TaskGroup." errors.
To solve this it's necessary manage this faults as ExceptionGroup, and that is what this implementation does.
As also arised errors
ERROR | open_webui.tasks:redis_task_command_listener:55 - Error handling distributed task command: Expecting value: line 1 column 1 (char 0)due to a Redis pub/sub message contains empty or invalid JSON data, a check for this situation is implemented.This errors are "dificult" to reproduce/verify, for this reason I also tested with a python script that generate failed concurrent tasks: test_exceptiongroup.py (place&execute in backend dir)
I tested in diferent ways, uploading multiples files, running the script some times between other tasks,...
Now only appear a
| WARNING | open_webui.tasks:redis_task_command_listener:46 - Invalid JSON in Redis message: invalid_json... Error: Expecting value: line 1 column 1 (char 0)Changes:
in tasks.py
Added caching for multiple concurrent exceptions.
Modified:
in main.py
Added caching for concurrent exceptions handler.
Modified:
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
Regards
Ricardo
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.