Fix: segfault when uploading multiple PDF attachments concurrently - #93
Open
lauty95 wants to merge 1 commit into
Open
Fix: segfault when uploading multiple PDF attachments concurrently#93lauty95 wants to merge 1 commit into
lauty95 wants to merge 1 commit into
Conversation
Contributor
Confidence Score: 5/5The PR appears safe to merge. All PDF rendering paths are covered by the lock, and the regression test exercises concurrent access. Reviews (1): Last reviewed commit: "fix: serialize PDF extraction to prevent..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Uploading two PDF attachments to a chat close together can crash the whole
bench startprocess. Not recoverable — needs a full restart.Screen.Recording.2026-08-07.at.12.37.21.PM.mov
Error
The frontend fires one
upload_filerequest per attached file, so two PDFs upload as two concurrent requests, each extracting text synchronously on its own threadpypdfium2wraps PDFium. Two threads calling into it at once corrupts its state and segfaults the process.Fix
Serializes all PDF processing in
flow/knowledge/extract.pybehind a single process-wide lock, so two PDFs uploaded together now get processed one after the other instead of racing.Screen.Recording.2026-08-07.at.12.38.39.PM.mov