Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/loader/container-loader/src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,9 @@ export class Container

this.storageAdapter.dispose();

// Dispose serialized state manager to clean up snapshot refresh timer
this.serializedStateManager.dispose();

// Notify storage about critical errors. They may be due to disconnect between client & server knowledge
// about file, like file being overwritten in storage, but client having stale local cache.
// Driver need to ensure all caches are cleared on critical errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,14 @@ export class SerializedStateManager {
},
);
}

/**
* Dispose of the SerializedStateManager, cleaning up any active timers.
* This prevents Node.js processes from hanging due to the refresh timer.
*/
public dispose(): void {
this.refreshTimer.clear();
Copy link

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

The dispose method should check if refreshTimer exists before calling clear() to avoid potential runtime errors if dispose() is called multiple times or if the timer was never initialized.

Suggested change
this.refreshTimer.clear();
if (this.refreshTimer) {
this.refreshTimer.clear();
}

Copilot uses AI. Check for mistakes.
}
}

/**
Expand Down
Loading