Skip to content

[VoiceLive] Fix issues: remove unnecessary subscribeOn, fix Disposable leaks, add graceful session close#48343

Open
xitzhang wants to merge 4 commits intomainfrom
voicelive/fix-p0-review-issues
Open

[VoiceLive] Fix issues: remove unnecessary subscribeOn, fix Disposable leaks, add graceful session close#48343
xitzhang wants to merge 4 commits intomainfrom
voicelive/fix-p0-review-issues

Conversation

@xitzhang
Copy link
Member

… Disposable leaks, remove phi4 models, add graceful session close

  • Remove subscribeOn(Schedulers.boundedElastic()) from parseToSessionUpdate() in VoiceLiveSessionAsyncClient to avoid per-event thread pool scheduling overhead
  • Store and dispose Disposable from receiveEvents().subscribe() in all 8 test files to prevent thread leaks
  • Remove phi4-mm-realtime and phi4-mini models from test parameter providers (not deployed in test region)
  • Remove unnecessary subscribeOn from MicrophoneInputSample and VoiceAssistantSample
  • Add session.close() to shutdown hooks in VoiceAssistantSample, FunctionCallingSample, and MCPSample to prevent NumberFormatException on Ctrl+C shutdown
  • Update CHANGELOG.md

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

… Disposable leaks, remove phi4 models, add graceful session close

- Remove subscribeOn(Schedulers.boundedElastic()) from parseToSessionUpdate()
  in VoiceLiveSessionAsyncClient to avoid per-event thread pool scheduling overhead
- Store and dispose Disposable from receiveEvents().subscribe() in all 8 test
  files to prevent thread leaks
- Remove phi4-mm-realtime and phi4-mini models from test parameter providers
  (not deployed in test region)
- Remove unnecessary subscribeOn from MicrophoneInputSample and VoiceAssistantSample
- Add session.close() to shutdown hooks in VoiceAssistantSample, FunctionCallingSample,
  and MCPSample to prevent NumberFormatException on Ctrl+C shutdown
- Update CHANGELOG.md
Copilot AI review requested due to automatic review settings March 10, 2026 00:06
@xitzhang
Copy link
Member Author

/azp run
java - azure-ai-voicelive - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

This PR updates the VoiceLive Java SDK and related tests/samples to reduce Reactor scheduling overhead, address resource leaks, and improve shutdown/cleanup behavior.

Changes:

  • Removed unnecessary subscribeOn(Schedulers.boundedElastic()) usage in the session event parsing pipeline and in audio sending within samples.
  • Updated live tests to track and dispose Disposable subscriptions, and removed unsupported phi4-* models from test parameters.
  • Added more graceful session shutdown behavior in samples and updated the changelog.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
sdk/voicelive/azure-ai-voicelive/src/main/java/com/azure/ai/voicelive/VoiceLiveSessionAsyncClient.java Removes per-event subscribeOn from parsing path.
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveVoicePropertiesTests.java Removes phi4 model; stores Disposable subscription (but cleanup not in finally).
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioTests.java Removes phi4 models; stores Disposable subscriptions (but cleanup not in finally).
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveAudioFormatTests.java Removes phi4 models; adds Disposable; re-enables a test (removes @Disabled).
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveConversationTests.java Stores Disposable subscriptions (but cleanup not in finally).
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTranscriptionTests.java Stores Disposable subscriptions (but cleanup not in finally).
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveTurnDetectionTests.java Disposes subscriptions in finally.
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveToolCallTests.java Disposes subscriptions in finally.
sdk/voicelive/azure-ai-voicelive/src/test/java/com/azure/ai/voicelive/livetests/VoiceLiveSessionTests.java Disposes subscriptions in finally.
sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/VoiceAssistantSample.java Removes subscribeOn and adds shutdown/cleanup session close.
sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MicrophoneInputSample.java Removes subscribeOn on audio send.
sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/MCPSample.java Adds session close on shutdown and on termination.
sdk/voicelive/azure-ai-voicelive/src/samples/java/com/azure/ai/voicelive/FunctionCallingSample.java Adds session close on shutdown and on termination.
sdk/voicelive/azure-ai-voicelive/CHANGELOG.md Notes removal of unnecessary subscribeOn in event parsing pipeline.

…tdown hooks

- Convert 13 test methods across 5 files from try/catch(Exception) to try/finally
  so subscription.dispose() and closeSession() run even on AssertionError
- Replace unbounded session.close() with closeAsync().block(Duration.ofSeconds(5))
  in shutdown hooks of VoiceAssistantSample, FunctionCallingSample, and MCPSample
  to prevent hanging during JVM teardown
@xitzhang
Copy link
Member Author

/azp run
java - azure-ai-voicelive - tests

@azure-pipelines
Copy link

Command 'run java' is not supported by Azure Pipelines.

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@xitzhang
Copy link
Member Author

/azp run java - azure-ai-voicelive - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@xitzhang xitzhang changed the title [VoiceLive] Fix issues: remove unnecessary subscribeOn, fix Disposable leaks, remove phi4 models, add graceful session close [VoiceLive] Fix issues: remove unnecessary subscribeOn, fix Disposable leaks, add graceful session close Mar 10, 2026
@xitzhang xitzhang enabled auto-merge (squash) March 10, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants