Skip to content

Java: release provider option values with the correct strings - #31828

Merged
Scott McKay (skottmckay) merged 6 commits into
microsoft:mainfrom
Nikhi00718:agent/fix-java-provider-string-release
Sep 3, 2026
Merged

Scott McKay (skottmckay) merged 6 commits into
microsoft:mainfrom
Nikhi00718:agent/fix-java-provider-string-release

Conversation

@Nikhi00718

@Nikhi00718 NIKHIL (Nikhi00718) commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • release CUDA provider option values against the jstring objects they came from
  • apply the same correction to the TensorRT provider option binding

Fixes #31706

Testing

  • git diff --check
  • A JNI/Gradle build could not be run locally because this Windows environment has no JDK or C compiler. The change is limited to the two provider-option release loops and is ready for repository CI.

AI assistance disclosure

I identified and reproduced the issue, then used OpenAI Codex to assist with the implementation and regression-test work. I personally reviewed the resulting diff and ran the validation commands listed above to verify the fix. Any full-suite or local-environment limitations are documented in the validation section.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@Nikhi00718
NIKHIL (Nikhi00718) marked this pull request as ready for review August 9, 2026 18:27
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@Nikhi00718

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@Craigacp

Copy link
Copy Markdown
Contributor

Yep, that's a bug, this fix is fine.

Copilot AI balanced review requested due to automatic review settings August 18, 2026 14:57

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@skottmckay

Copy link
Copy Markdown
Contributor

Can we keep CI changes out of this simple PR, especially ones that add new components?

@Nikhi00718

Copy link
Copy Markdown
Contributor Author

I removed the unrelated Chromium-install workflow change and pushed commit e17acd8, leaving the provider-option string ownership fix focused on the two native binding files. The existing maintainer approval was later dismissed after the CI changes, so this new head still needs a fresh maintainer review. Please run the authorized native Java/provider checks and confirm the CUDA/TensorRT value release loops against the jValueArr objects.

@Craigacp

Copy link
Copy Markdown
Contributor

There are still CI changes here that shouldn't be.

@Nikhi00718

Copy link
Copy Markdown
Contributor Author

Follow-up: I also removed the remaining unrelated CUDA CI thread-count change and pushed commit dd9c386. The PR now changes only these two files: java/src/main/native/ai_onnxruntime_providers_OrtCUDAProviderOptions.c and java/src/main/native/ai_onnxruntime_providers_OrtTensorRTProviderOptions.c. The live diff is now focused solely on fetching provider option values from jValueArr before releasing their UTF-8 buffers. It still needs fresh maintainer review and authorized native Java/provider CI.

@Nikhi00718

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 31828 in repo microsoft/onnxruntime

@Nikhi00718

Copy link
Copy Markdown
Contributor Author

Validation update: the live diff is clean against upstream/main (2 files, 2 insertions, 2 deletions; git diff --check passes). I triggered /azp run, but Azure replied that this contributor account lacks sufficient privileges for PR 31828. The GitHub workflows for this head are also paused as action_required. A maintainer needs to approve/rerun the protected CI and refresh the review on dd9c386; no further code changes are needed from my side.

@Nikhi00718

Copy link
Copy Markdown
Contributor Author

Scott McKay (@skottmckay) Thanks for updating the branch with current main. All checks on the current head are now green, and the PR diff remains limited to the two intended JNI provider-option string ownership corrections. When convenient, could you please provide the final review/approval?

@skottmckay
Scott McKay (skottmckay) merged commit ff8d83b into microsoft:main Sep 3, 2026
91 checks passed
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.

[Java] CUDA/TensorRT applyToNative() releases the value string's UTF chars with the key string's jstring

4 participants