Repository navigation
Fix missing instance ticket token JNI binding - #1552
Merged
Merged
Conversation
Implement the existing Java native contract through the instance auth tokens controller while preserving status and conversion failures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the new instance ticket-token JNI binding.
No open issues 🎉
What changed in this PR
Adds the missing JNI binding for ILogManager.setTicketToken on managers created by LogManagerProvider, resolving the reported UnsatisfiedLinkError.
Changes:
- Delegates to the instance authentication tokens controller and returns its status.
- Returns
EFAILfor unavailable managers or controllers and preserves pending Java string-conversion exceptions. - Leaves the existing static entry point unchanged.
| File | Description |
|---|---|
lib/jni/LogManager_jni.cpp |
Implements the instance ticket-token JNI entry point with failure handling. |
Review effort: Balanced
bmehta001
approved these changes
Nov 5, 2026
Prevent token refresh and clear operations from racing with HTTP header encoding and event decoration. Use an internal SDK-wide lock to preserve the public API and object layout, and document the synchronization requirement for legacy live-reference getters. Register each user ticket key only once so repeated refreshes do not grow memory and every subsequent event payload. Cover refresh, clear/re-registration, and concurrent writers with active SDK readers. Validation: 51 targeted tests passed with VS 2026; 42 token/encoder/decorator tests passed under WSL Clang ThreadSanitizer. Public-header gates, changed-lines clang-format, diff whitespace, and CI misspell passed. The original code fails the new deduplication test and reports a token race under ThreadSanitizer. A separate pre-existing LogManagerImpl construction vptr race was reproduced on the original code and is not suppressed or modified here. Files changed: - lib/api/AuthTokensController.cpp - lib/api/AuthTokensController.hpp - lib/decorators/BaseDecorator.cpp - lib/http/HttpRequestEncoder.cpp - lib/include/public/IAuthTokensController.hpp - tests/unittests/HttpRequestEncoderTests.cpp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0d8996b4-37b3-4519-870a-4ce3be753d08
Baiju Meswani (baijumeswani)
approved these changes
Nov 5, 2026
bmehta001
enabled auto-merge (squash)
November 5, 2026 07:06
Contributor
|
Thanks star-du (@star-du) for your contribution. I have hardened and merged in your PR. |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Calling
ILogManager.setTicketTokenon a manager created byLogManagerProviderthrowsUnsatisfiedLinkError: Java declares the instance native method, but the corresponding JNI entry point is missing.Implement the bridge to the instance auth tokens controller and return its status. Invalid managers or unavailable controllers return
EFAIL; pending Java string-conversion exceptions are preserved. The existing static entry point remains unchanged.Also address the controller risks exposed by this call path:
The internal SDK-wide lock preserves the existing public API and object layout. It serializes token access across manager instances. Applications using the legacy reference-returning getters must still avoid accessing those live references concurrently with updates; this requirement is documented in the interface.
Related: #1218 (closed without merging).
Validation
halt_on_error=1, without sanitizer suppressions or disabled tests.AuthTokensController::SetTicketToken. Both pass with the fixes.git diff --check, and the same hash-verified misspell release used by CI passed on all changed files.A broader sanitizer run also found a separate, pre-existing vptr race during
TestLogManagerImplconstruction (TransmissionPolicyManager.cpp:19). That race was reproduced against the original PR code and remains unchanged and unsuppressed; the 42-test sanitizer pass above does not include the LogManagerImpl suite.No Android device or Java-to-JNI runtime tests were run locally.