fix(desktop): Gmail import deadlock on large mailboxes (#8797)#8803
Merged
Conversation
…8797) The Gmail/Email connector launched a Python helper, called process.waitUntilExit(), then read stdout via readDataToEndOfFile(). When the helper emits a large JSON payload (up to 300 emails), the stdout pipe buffer fills, the child blocks in write(2), and the parent blocks in waitUntilExit() -> the import spins on 'Importing...' forever with no error. Drain stdout/stderr asynchronously via readabilityHandler while the helper runs, and add a 60s terminate timeout so a stuck/slow helper surfaces an actionable error instead of hanging. Mirrors the existing safe pattern in CalendarReaderService.
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.
Bug
The macOS Gmail/Email connector hangs indefinitely on
Importing…/Connecting to Gmailand never completes — no counts, no error (#8797, p0).Root cause
GmailReaderService.fetchGmailViaAtomFeedSinglelaunched the Python helper, then:When the helper prints a large JSON payload (up to 300 emails) to stdout, the pipe buffer fills, the child blocks in
write(2), and the parent blocks inwaitUntilExit()— a classic pipe deadlock. The UI spins forever with no timeout/error path.Fix
readabilityHandlerwhile the helper runs, thenwaitUntilExit()— the child can never block on a full buffer.CalendarReaderService.Scope: one file (+ changelog fragment), ~40 lines. Compiles clean (
xcrun swift build -c debug, Build complete).🤖 automated by hourly watchdog; opened for review, not merged.