Skip to content

AdaptiveMemoryManager: unhandled promise rejections from async setInterval callback #69

@thedhanawada

Description

@thedhanawada

Bug Description

AdaptiveMemoryManager.startMonitoring() (line 71 in core/performance/AdaptiveMemoryManager.js) passes an async function to setInterval:

this.monitoringInterval = setInterval(() => {
    this.checkMemoryPressure();  // returns Promise, never awaited
}, this.config.checkInterval);

checkMemoryPressure() is an async method (line 92). The arrow function calls it but doesn't await or catch the returned promise. If checkMemoryPressure() throws, the rejection is unhandled.

Impact

  • Unhandled promise rejections in Node.js can crash the process (depending on --unhandled-rejections flag)
  • In browsers, silently swallowed errors make debugging impossible
  • Memory management failures go undetected

Expected Fix

Either:

  1. Add .catch() to the checkMemoryPressure() call in the interval
  2. Wrap in try/catch with error logging
  3. Consider making checkMemoryPressure() synchronous with internal error handling

Files

  • core/performance/AdaptiveMemoryManager.js:71-73 (setInterval)
  • core/performance/AdaptiveMemoryManager.js:92 (async method)

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase:0-foundationImmediate fixes and test infrastructurepriority:highImportant for next milestonetype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions