Skip to content

fix(server): release loading owner without auth - #3488

Open
arimu1 wants to merge 1 commit into
apache:masterfrom
arimu1:fix/3487-loading-owner-auth-disabled
Open

arimu1 wants to merge 1 commit into
apache:masterfrom
arimu1:fix/3487-loading-owner-auth-disabled

Conversation

@arimu1

@arimu1 arimu1 commented Nov 29, 2026

Copy link
Copy Markdown

Purpose of the PR

With authentication disabled, acquire and release of the LOADING owner can run on different Grizzly workers. HugeGraphAuthProxy.username() then returns inherited admin on a fresh worker and anonymous after the request filter resets the ThreadLocal, so the same loader token fails with HTTP 409 and the graph stays in LOADING.

Main Changes

  • Read the loading-owner principal from the request Authorizer (the same object the recover path already uses).
  • Fall back to HugeGraphAuthProxy.username() only when that Authorizer is absent.
  • Add a unit test that acquires as anonymous while the ThreadLocal is still admin, then releases after reset.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test -Dtest=org.apache.hugegraph.unit.api.space.GraphSpaceAPITest -DfailIfNoTests=false -Dcheckstyle.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true
    • Result: Tests run: 18, Failures: 0, Errors: 0, Skipped: 0 including testAuthDisabledLoadingOwnerIgnoresStaleThreadLocalPrincipal
    • Existing testUnproxiedLoadingOwnerUsesAuthenticatedPrincipal still rejects a different ThreadLocal principal when no Authorizer is present

Does this PR potentially affect the following parts?

Documentation Status

Select one option and provide the documentation location when applicable.

  • Doc - TODO: required documentation is pending; complete it before merging.
  • Doc - Done: documentation is included here or linked below.
  • Doc - No Need: no user-visible documentation is affected.

Documentation files in this PR or paired hugegraph-doc PR:

Made with Cursor

Use the request Authorizer as the loading-owner principal so acquire
and release stay on the same identity when authentication is off.
ThreadLocal username can be inherited admin then anonymous after reset.
Fall back to HugeGraphAuthProxy.username() when Authorizer is absent.

Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.63%. Comparing base (f60b628) to head (bc35621).

Additional details and impacted files
@@            Coverage Diff             @@
##             master    #3488    +/-   ##
==========================================
  Coverage     58.63%   58.63%            
- Complexity     6933     7311   +378     
==========================================
  Files           780      780            
  Lines         69635    69637     +2     
  Branches       9605     9606     +1     
==========================================
+ Hits          40829    40831     +2     
- Misses        25115    25120     +5     
+ Partials       3691     3686     -5     
Flag Coverage Δ *Carryforward flag
commons 96.37% <ø> (ø) Carriedforward from f60b628
hstore 36.15% <ø> (+<0.01%) ⬆️ Carriedforward from f60b628
pd 57.01% <ø> (ø) Carriedforward from f60b628
server_hbase 42.42% <ø> (+<0.01%) ⬆️ Carriedforward from f60b628
server_memory 57.07% <100.00%> (+<0.01%) ⬆️
server_rocksdb 42.91% <0.00%> (+0.01%) ⬆️
store 36.17% <ø> (ø) Carriedforward from f60b628

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bitflicker64 bitflicker64 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.

Blocking: no. Summary: Taking the loading-owner principal from the request Authorizer gives acquire and release the same anonymous identity when auth is off, and the proxied auth path still ignores the argument. The new test fails on the base GraphsAPI with the 409 from #3487 and passes at this head.

@imbajin
imbajin requested an adaptive review from Copilot November 29, 2026 12: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 insufficient remaining quota. Try requesting a review at a lower effort level.

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Score: 9.0/10 · Confidence: medium

Blocking: no

Summary

No actionable findings. The request authorizer keeps the loading owner identity stable when authentication is disabled, while the authenticated proxy continues to enforce its own identity.

Evidence

Reviewed the request filter, owner acquire/release implementation, authenticated proxy and regression test. Server memory and RocksDB CI jobs passed for this head.

Validation notes

I did not independently run the test or exercise a live multi-worker HTTP server; the regression test constructs the request context directly.

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.

[Bug] Loader cannot release its LOADING owner on a fresh server with auth disabled (409, graph stays in LOADING)

4 participants