Repository navigation
Fix invalid AuthMech crashing with Recursive update / StackOverflowError - #1558
Closed
sreekanth-db wants to merge 2 commits into
Closed
sreekanth-db wants to merge 2 commits into
sreekanth-db wants to merge 2 commits into
Conversation
Connecting with an unsupported AuthMech (e.g. AuthMech=99) intermittently crashed with an internal IllegalStateException: Recursive update or a StackOverflowError on both SEA and Thrift, instead of a clean validation error. The value was detected deep inside ClientConfigurator construction, which runs inside getConfigurator's ConcurrentHashMap.computeIfAbsent; the failure fired a telemetry log whose feature-flag refresh re-entered getConfigurator for the same connectionUuid, causing a reentrant computeIfAbsent. Validate AuthMech at connect time (DatabricksConnectionContext.parse -> ValidationUtil.validateInputProperties) before the configurator machinery runs, rejecting unsupported values deterministically with a DatabricksValidationException (SQLState=INPUT_VALIDATION_ERROR). A pure AuthMech.fromValue lookup is the single source of truth for supported values. Signed-off-by: Sreekanth Vadigi <[email protected]>
vikrantpuppala
approved these changes
Jul 29, 2026
…h-fail-fast Signed-off-by: Sreekanth Vadigi <[email protected]> # Conflicts: # NEXT_CHANGELOG.md
Collaborator
Author
|
Closing in favor of a same-repo PR. Fork PRs cannot access |
4 tasks done
sreekanth-db
added a commit
that referenced
this pull request
Jul 29, 2026
…ror (#1586) ## Summary - Connecting with an unsupported `AuthMech` (e.g. `AuthMech=99`) intermittently failed with an internal `IllegalStateException: Recursive update` or a `StackOverflowError` on both the SEA and Thrift paths, instead of a clean validation error. - Root cause: `AuthMech.parseAuthMech` throws during `ClientConfigurator` construction, which runs inside `DatabricksClientConfiguratorManager.getConfigurator`'s `ConcurrentHashMap.computeIfAbsent`. The exception's constructor emits a telemetry failure log, whose feature-flag refresh re-enters `getConfigurator` for the **same** `connectionUuid` → a reentrant `computeIfAbsent` → `Recursive update` (or, depending on timing, `StackOverflowError`). - Fix: validate `AuthMech` at connect time in `DatabricksConnectionContext.parse()` (via `ValidationUtil.validateInputProperties` → new `validateAuthMech`), **before** the configurator machinery runs. Unsupported values are now rejected deterministically with a `DatabricksValidationException` (`SQLState=INPUT_VALIDATION_ERROR`). - A pure, side-effect-free `AuthMech.fromValue(int)` lookup is introduced as the single source of truth for supported values (`3`=PAT, `11`=OAuth); `parseAuthMech` delegates to it, so adding a new AuthMech is a one-line change. `parseAuthMech`'s behavior, exception type, and messages are unchanged. Replaces fork PR #1558 (same-repo so required JDBC Integration Tests can be reported). ## Test plan - [x] New unit tests `ValidationUtilTest#testValidateAuthMech_*`: supported values (`3`, `11`, omitted) pass; unsupported/non-integer/empty throw `INPUT_VALIDATION_ERROR`. - [x] New unit test `DatabricksConnectionContextTest#parse_rejectsUnsupportedAuthMech_withInputValidationError`. - [x] Existing `AuthFlowParsing` and full `ValidationUtilTest` (47) / `DatabricksConnectionContextTest` (145) suites pass. - [x] Manual repro against a live warehouse: `AuthMech=99` went from `IllegalStateException: Recursive update` (5/5 attempts on both SEA and Thrift) to a clean `DatabricksValidationException` / `INPUT_VALIDATION_ERROR` (5/5 on both transports). Signed-off-by: Sreekanth Vadigi <[email protected]>
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
AuthMech(e.g.AuthMech=99) intermittently failed with an internalIllegalStateException: Recursive updateor aStackOverflowErroron both the SEA and Thrift paths, instead of a clean validation error.AuthMech.parseAuthMechthrows duringClientConfiguratorconstruction, which runs insideDatabricksClientConfiguratorManager.getConfigurator'sConcurrentHashMap.computeIfAbsent. The exception's constructor emits a telemetry failure log, whose feature-flag refresh re-entersgetConfiguratorfor the sameconnectionUuid→ a reentrantcomputeIfAbsent→Recursive update(or, depending on timing,StackOverflowError).AuthMechat connect time inDatabricksConnectionContext.parse()(viaValidationUtil.validateInputProperties→ newvalidateAuthMech), before the configurator machinery runs. Unsupported values are now rejected deterministically with aDatabricksValidationException(SQLState=INPUT_VALIDATION_ERROR).AuthMech.fromValue(int)lookup is introduced as the single source of truth for supported values (3=PAT,11=OAuth);parseAuthMechdelegates to it, so adding a new AuthMech is a one-line change.parseAuthMech's behavior, exception type, and messages are unchanged.Test plan
ValidationUtilTest#testValidateAuthMech_*: supported values (3,11, omitted) pass; unsupported/non-integer/empty throwINPUT_VALIDATION_ERROR.DatabricksConnectionContextTest#parse_rejectsUnsupportedAuthMech_withInputValidationError.AuthFlowParsingand fullValidationUtilTest(47) /DatabricksConnectionContextTest(145) suites pass.AuthMech=99went fromIllegalStateException: Recursive update(5/5 attempts on both SEA and Thrift) to a cleanDatabricksValidationException/INPUT_VALIDATION_ERROR(5/5 on both transports).