Skip to content

[JS] Fix is_generating check fails#3490

Open
Retribution98 wants to merge 3 commits intoopenvinotoolkit:masterfrom
Retribution98:fix_is_generating_fails
Open

[JS] Fix is_generating check fails#3490
Retribution98 wants to merge 3 commits intoopenvinotoolkit:masterfrom
Retribution98:fix_is_generating_fails

Conversation

@Retribution98
Copy link
Contributor

Description

Reset is_generating flag before calling report_error() in the error path of generatePerformInferenceThread to prevent a race condition where the JS event loop could schedule the next generate() call before the native thread clears the flag.

CVS-182798

Checklist:

  • This PR follows GenAI Contributing guidelines.
  • Tests have been updated or added to cover the new code.
  • This PR fully addresses the ticket.
  • I have made corresponding changes to the documentation.

Signed-off-by: Kirill Suvorov <kirill.suvorov@intel.com>
@Retribution98 Retribution98 requested a review from yatarkan as a code owner March 12, 2026 16:33
Copilot AI review requested due to automatic review settings March 12, 2026 16:33
@github-actions github-actions bot added the category: JS API GenAI JS API label Mar 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a JS bindings race where the next generate() call can be scheduled before the native inference thread clears the is_generating flag in error paths, causing erroneous “already in progress” failures.

Changes:

  • Reorders error handling in Whisper/VLM native inference threads to clear is_generating before calling report_error().
  • Updates LLM native inference thread error handling to clear is_generating, report the error, then finalize() and return (preventing fall-through into the success path).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
src/js/src/whisper_pipeline/pipeline_wrapper.cpp Clears is_generating before invoking report_error() on inference exceptions.
src/js/src/vlm_pipeline/vlm_pipeline_wrapper.cpp Clears is_generating before invoking report_error() on inference exceptions.
src/js/src/llm_pipeline/llm_pipeline_wrapper.cpp Clears is_generating and properly finalizes/returns on inference exceptions.

You can also share your feedback on Copilot code review. Take the survey.

@Retribution98 Retribution98 marked this pull request as draft March 12, 2026 16:59
@Retribution98 Retribution98 marked this pull request as ready for review March 13, 2026 11:09
Copilot AI review requested due to automatic review settings March 13, 2026 11:09
Copy link
Contributor

Copilot AI left a comment

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 12 out of 12 changed files in this pull request and generated 2 comments.


You can also share your feedback on Copilot code review. Take the survey.

@Retribution98 Retribution98 force-pushed the fix_is_generating_fails branch from 9034133 to c4e82bf Compare March 13, 2026 13:14
@kkm121
Copy link

kkm121 commented Mar 14, 2026

.take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: JS API GenAI JS API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants