alibaba / alibaba/ROCK

[Bug] Jest worker process leak in model client.test.ts due to uncleaned timers

Open Beginner friendly
#838 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
485
Forks
81
Avg merge
16h 12m
Merged PRs (30d)
8

Description

**Bug Description**
rock/ts-sdk/src/model/client.test.ts 中的 Jest 单元测试存在 timer 泄漏问题,导致 Jest worker 进程无法正常退出,被强制终止。

**Steps to Reproduce**
1. cd rock/ts-sdk
2. pnpm test:unit
3. 测试全部通过后,观察控制台输出的警告信息

**Expected Behavior**
所有单元测试通过后,Jest 进程正常退出,无任何警告。
**Actual Behavior**
所有测试通过,但 Jest 打印 worker 泄漏警告并强制终止 worker 进程。
**Error Logs**
`A worker process has failed to exit gracefully and has been force exited.
This is likely caused by tests leaking due to improper teardown.
Try running with --detectOpenHandles to find leaks.
Active timers can also cause this, ensure that .unref() was called on them.`
**Environment Information**
- **OS**: [e.g. Ubuntu 22.04, macOS 13.0, Windows 11]
- **Python Version**: [e.g. 3.11.5]
- **ROCK Version**: [e.g. 0.2.0]
- **Installation Method**: [e.g. pip install rl-rock, source installation with uv]
- **Docker Version**: [e.g. 24.0.6] (if using sandbox features)
- **Deployment Type**: [e.g. local, distributed, ray]

**ROCK Configuration**
- **Runtime Environment Type**: uv
- **Sandbox Image**: python:3.11
- **Resource Allocation**: default

**Component Affected**
- [ ] Sandbox
- [ ] Actions
- [ ] Deployments
- [x] SDK & API
- [ ] Envhub
- [ ] CLI
- [ ] Performance & Optimization
- [ ] Documentation & Examples

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with rock/ts-sdk/src/model/client.test.ts and run pnpm test:unit, then use Jest's --detectOpenHandles option to identify the active timer. Clean up the leaked timer in the test teardown, and verify that all tests pass without the worker-exit warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.