Skip to content

[Enhancement] Patch OmniStage.try_collect() with _proc alive checks#1560

Open
pi314ever wants to merge 3 commits intovllm-project:mainfrom
pi314ever:omni-stage-try-collect-proc-patch
Open

[Enhancement] Patch OmniStage.try_collect() with _proc alive checks#1560
pi314ever wants to merge 3 commits intovllm-project:mainfrom
pi314ever:omni-stage-try-collect-proc-patch

Conversation

@pi314ever
Copy link
Contributor

PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.

Purpose

Waiting for OmniStage involves checking the output queue for results. However, try_collect() does not check if process has died and will hang indefinitely. This fixes this issue by explicitly checking that the process is alive before attempting to read the output queue. Component of #1557 relating to issue #1346

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan. Please provide the test scripts & test commands. Please state the reasons if your codes don't require additional test scripts. For test file guidelines, please check the test style doc
  • The test results. Please paste the results comparison before and after, or the e2e results.
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model. Please run mkdocs serve to sync the documentation editions to ./docs.
  • (Optional) Release notes update. If your change is user-facing, please update the release notes draft.

BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)

Signed-off-by: Daniel Huang <daniel1.huang@intel.com>
@pi314ever
Copy link
Contributor Author

@xuechendi

Copy link
Contributor

@xuechendi xuechendi left a comment

Choose a reason for hiding this comment

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

LGTM

@pi314ever
Copy link
Contributor Author

@hsliuustc0106 ^

@hsliuustc0106
Copy link
Collaborator

@ApsarasX PTAL

request_id, engine_outputs (or engine_outputs_shm), and metrics.
"""
assert self._out_q is not None
if self._proc is not None and not self._proc.is_alive():
Copy link
Contributor

Choose a reason for hiding this comment

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

Race condition: is_alive() is checked before get_nowait(), so if the worker finishes its last batch and exits between these two calls, you'll throw away valid results still sitting in the queue. Flip the order — try the queue first, then check is_alive() only when the queue is empty:

Suggested change
if self._proc is not None and not self._proc.is_alive():
try:
return self._out_q.get_nowait()
except queue.Empty:
pass
if self._proc is not None and not self._proc.is_alive():
raise RuntimeError("OmniStage Worker process died unexpectedly")
return None

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, fixed.

"""
assert self._out_q is not None
if self._proc is not None and not self._proc.is_alive():
raise RuntimeError("OmniStage Worker process died unexpectedly")
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: include self._proc.exitcode in the message — it is available once the process has terminated and makes debugging a lot easier.

Copy link
Contributor

@lishunyang12 lishunyang12 left a comment

Choose a reason for hiding this comment

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

Left a couple comments. The main one is a race between the is_alive() check and the queue read — the current ordering can discard valid results that are already queued when the worker exits normally.

Signed-off-by: Daniel Huang <daniel1.huang@intel.com>
Signed-off-by: Daniel Huang <daniel1.huang@intel.com>
@pi314ever
Copy link
Contributor Author

@lishunyang12 I resolved your comments with minor tweaks.

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.

4 participants