Skip to content

fix false negative healthy status check for turbomind #4745

Open
irexyc wants to merge 2 commits into
InternLM:mainfrom
irexyc:fix-tm-health
Open

fix false negative healthy status check for turbomind #4745
irexyc wants to merge 2 commits into
InternLM:mainfrom
irexyc:fix-tm-health

Conversation

@irexyc

@irexyc irexyc commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Please describe the motivation of this PR and the goal you want to achieve through this PR.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@irexyc irexyc marked this pull request as ready for review July 10, 2026 09:35
Copilot AI review requested due to automatic review settings July 10, 2026 09:35
@irexyc irexyc changed the title fix false negative for healthy status check for turbomind fix false negative healthy status check for turbomind Jul 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts TurboMind’s async health probe implementation to reduce false-negative “unhealthy” reports caused by event-loop/default threadpool contention (notably when multimodal workloads enqueue many background tasks).

Changes:

  • Introduces a (dedicated) ThreadPoolExecutor intended for health checks.
  • Switches get_health_status() from asyncio.to_thread(...) to loop.run_in_executor(...) to avoid blocking/queueing behind the default executor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lmdeploy/turbomind/turbomind.py Outdated
self._create_engine()

self.session_len = _engine_config.session_len
self.health_executor = ThreadPoolExecutor(max_workers=1) if engine_config.enable_metrics else None
Comment thread lmdeploy/turbomind/turbomind.py Outdated
self._create_engine()

self.session_len = _engine_config.session_len
self.health_executor = ThreadPoolExecutor(max_workers=1) if engine_config.enable_metrics else None
Comment on lines +423 to +426
# MultimodalProcessor may submit a large number of tasks to the default thread pool, causing
# the _get_health_status task to be selected after the DEFAULT_PROBE_TIMEOUT has already elapsed.
loop = asyncio.get_running_loop()
return await loop.run_in_executor(self.health_executor, self._get_health_status)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines 175 to +176
self.session_len = _engine_config.session_len
self.health_executor = ThreadPoolExecutor(max_workers=1)
Comment on lines +425 to +426
loop = asyncio.get_running_loop()
return await loop.run_in_executor(self.health_executor, self._get_health_status)
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