Skip to content

fix: close DEBUG_IMAP file descriptor on shutdown#1337

Open
MD-Mushfiqur123 wants to merge 1 commit into
floatpane:masterfrom
MD-Mushfiqur123:fix/debug-imap-fd-leak
Open

fix: close DEBUG_IMAP file descriptor on shutdown#1337
MD-Mushfiqur123 wants to merge 1 commit into
floatpane:masterfrom
MD-Mushfiqur123:fix/debug-imap-fd-leak

Conversation

@MD-Mushfiqur123
Copy link
Copy Markdown
Contributor

Fixes #715. Adds fetcher.CloseDebugFiles() to close the DEBUG_IMAP file handle on application shutdown, preventing a file descriptor leak for the application lifetime.

@MD-Mushfiqur123 MD-Mushfiqur123 requested a review from a team as a code owner May 22, 2026 06:08
Copy link
Copy Markdown
Member

@floatpanebot floatpanebot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MD-Mushfiqur123! Please fix the following issues with your PR:

  • Title: Is too long (49 characters). The PR title must be strictly under 40 characters.
  • Body: Missing the ## What? or ## Why? headings required by the PR template.

@floatpanebot floatpanebot added area/fetcher IMAP fetch / IDLE / search bug Something isn't working size/XS Diff: 0–10 lines labels May 22, 2026
Comment thread main.go
args, level := parseGlobalFlags(os.Args)
os.Args = args
loglevel.Set(level)
defer fetcher.CloseDebugFiles()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defer is not enough here because many paths in main() exit via os.Exit(...), and Go does not run deferred calls on os.Exit. For example, matcha daemon run can open DEBUG_IMAP, then return through runDaemonCLI and hit os.Exit(0), so CloseDebugFiles() is skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/fetcher IMAP fetch / IDLE / search bug Something isn't working size/XS Diff: 0–10 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: File descriptor leak in DEBUG_IMAP logger

3 participants