refactor: unify markdown parsing logic to avoid memory leaking#21981
refactor: unify markdown parsing logic to avoid memory leaking#21981ShirasawaSama wants to merge 1 commit into
Conversation
👋 Welcome and Thank You for Contributing!We appreciate you taking the time to submit a pull request to Open WebUI!
|
4644d15 to
fc5742b
Compare
|
👍 |
|
@Classic298 this needs to be tested |
fc5742b to
2830e28
Compare
|
@Classic298 Would you be available to help me test this? My local testing might not cover all scenarios. I've noticed this component has a pretty severe memory leak. |
|
@ShirasawaSama will test, can you rebase this to latest dev? Thanks |
2830e28 to
753a919
Compare
|
@Classic298 I have rebased to the latest dev branch and revalidated the core scenarios locally. |
|
Has there been any progress on this? |
753a919 to
7c7eed7
Compare
|
@Classic298 In fact, we’ve found that a major cause of memory leaks right now is that the scope of the entire chat component is leaking into the marked global instance, which causes memory to keep growing and prevents it from being garbage collected. |
|
@pr-validator-bot pls review |
|
too many files to review properly |
|
@pr-validator-bot review |
🔍 Automated Code ReviewCode Review Findings (click to expand)
This is an automated review. If you believe any finding is incorrect, please explain in a comment below. |
7c7eed7 to
6406f94
Compare
|
@pr-validator-bot review |
✅ Automated Code ReviewNo significant issues were detected in this PR. |
6406f94 to
f3e07af
Compare
|
@pr-validator-bot review |
🤖 Automated Code Review🔍 Standard Review — 🔍 Findings
🔎 Thorough Review — 🔍 FindingsWarning – Sanitization options are being passed to the markdown parser, not to DOMPurifyFile:
renderMarkdownToHTMLSanitized(content, { ALLOWED_TAGS: [] })But in So Why this matters:
Recommendation:
Suggestion –
|
f3e07af to
3f7b440
Compare
|
@pr-validator-bot review |
🤖 Automated Code Review🔍 Standard Review — ✅ No issuesNo issues detected. 🔎 Thorough Review — 🔍 FindingsMarkdown utility refactor reviewOverall this is a solid consolidation and removes a lot of repeated Warning —
|
3f7b440 to
3bf95aa
Compare
|
@pr-validator-bot review |
🤖 Automated Code Review🔍 Standard Review — ✅ No issuesNo issues detected. 🔎 Thorough Review — 🔍 Findings
|
3bf95aa to
77edbd5
Compare
|
@pr-validator-bot review |
|
i made some changes. thanks for testing it. lets see if it works |
Which branch/PR? |
|
to the bot |
OK, I think it's pretty good. |
🔎 Automated Code ReviewReview Findings (click to expand)Markdown refactor reviewOverall this is a solid refactor direction (centralizing Marked config and eliminating repeated Warning: behavior regression for newline handling (
|
|
i agree. but it is expensive as hell. I had to cut the normal review. now it only does the thorough review from now on |
What model are you using? Is it a Claude model? |
|
No. I have tested many models. GPT-5.3-Codex works the best for these reviews. It is very thorough and flags things that Claude does not flag. |
Actually, I find Copilot's code review really useful. You can check out this PR of mine for reference. |
|
All I can say is, if we were still deploying this project, I’d be using the company’s Opus 4.6 to review it thoroughly—that’s exactly how I used to submit code. Unfortunately, my commits are now just my own personal efforts. |
|
Opus 4.6 is not bad. Not at all. But i feel like it just misses things that GPT-5.3-Codex catches. |
Yes, just last week I spent $680 in a single day using Opus 4.6 to fix several states issues with the
|
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Changelog Entry
Description
The current logic for parsing Markdown and registering Marked extensions is scattered across various files, leading to the following issues:
Added
Changed
Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
Screenshots or Videos
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.
Note
Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.