Skip to content

Conversation

@ParidelPooya
Copy link
Contributor

fix: prevent worker process hanging with proper timer cleanup

Fixes 'A worker process has failed to exit gracefully' error by ensuring all setTimeout timers are properly cleaned up.

Root Cause:

- waitBeforeContinue creates multiple polling timers via setTimeout
- Promise.race resolves when any condition is met
- Remaining timers from unresolved promises kept running
- Jest worker processes couldn't exit due to active handles

Solution:

- Track all setTimeout timers in arrays
- Clear all timers after Promise.race resolves
- Add proper cleanup in both implementation and tests
- Prevent resource leaks and hanging processes

Changes:

- waitBeforeContinue: Track and cleanup timers after Promise.race
- Tests: Track test timers and clear in afterEach hooks
- Eliminates worker process hanging warnings
- Ensures proper resource management in production

Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.

## Root Cause:
- waitBeforeContinue creates multiple polling timers via setTimeout
- Promise.race resolves when any condition is met
- Remaining timers from unresolved promises kept running
- Jest worker processes couldn't exit due to active handles

## Solution:
- Track all setTimeout timers in arrays
- Clear all timers after Promise.race resolves
- Add proper cleanup in both implementation and tests
- Prevent resource leaks and hanging processes

## Changes:
- waitBeforeContinue: Track and cleanup timers after Promise.race
- Tests: Track test timers and clear in afterEach hooks
- Eliminates worker process hanging warnings
- Ensures proper resource management in production
@ParidelPooya ParidelPooya merged commit 8b20711 into development Sep 7, 2025
1 check passed
@ParidelPooya ParidelPooya deleted the fix/timer-cleanup-v2 branch September 7, 2025 01:28
ParidelPooya added a commit that referenced this pull request Oct 10, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Oct 12, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Oct 24, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Oct 26, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Nov 2, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Nov 6, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Nov 6, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Nov 6, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
ParidelPooya added a commit that referenced this pull request Nov 7, 2025
fix: prevent worker process hanging with proper timer cleanup
    
Fixes 'A worker process has failed to exit gracefully' error by ensuring
all setTimeout timers are properly cleaned up.
    
## Root Cause:
    - waitBeforeContinue creates multiple polling timers via setTimeout
    - Promise.race resolves when any condition is met
    - Remaining timers from unresolved promises kept running
    - Jest worker processes couldn't exit due to active handles
    
## Solution:
    - Track all setTimeout timers in arrays
    - Clear all timers after Promise.race resolves
    - Add proper cleanup in both implementation and tests
    - Prevent resource leaks and hanging processes
    
## Changes:
    - waitBeforeContinue: Track and cleanup timers after Promise.race
    - Tests: Track test timers and clear in afterEach hooks
    - Eliminates worker process hanging warnings
    - Ensures proper resource management in production

Co-authored-by: Pooya Paridel <parpooya@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants