Skip to content

[repo-monitor] Medium: Browser handler task not cancelled on close() — Chrome process leak #5

@Liohtml

Description

@Liohtml

Summary

The tokio::spawn handler task's JoinHandle is discarded, so the Chrome process and handler task may persist indefinitely if close() is not called or fails.

Location

  • File: src/core/browser.rs
  • Line(s): 52–63, 119–125

Severity

Medium

Details

BrowserManager::new spawns a task that drives the chromiumoxide handler. The JoinHandle is discarded. There is no Drop implementation. If close() is not called (e.g., early return, panic), the Chrome process and spawned task persist indefinitely.

Suggested Fix

Store the JoinHandle and abort it in close(), and implement Drop:

struct BrowserManager {
    browser: Browser,
    page: Page,
    headless: bool,
    handler_task: tokio::task::JoinHandle<()>,
}
// In close(): self.handler_task.abort();
// Also implement Drop as a safety net.

Automated finding by repo-monitor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions