fix(core): Eliminate mapping race condition#876
Merged
Merged
Conversation
The ephemeral authentication path in authenticate_ephemeral returned AuthenticationResult without authorization, forcing a second storage read via get_mapping_provider().get_virtual_user(). Since get_by_key does not enforce Raft linearizability for tier-0 data, the read could return stale state under concurrent requests. Derive AuthzInfo directly from match_result.authorizations and attach it to the authentication result, eliminating the second read entirely. Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
gtema
enabled auto-merge
June 29, 2026 15:34
gtema
added this pull request to the merge queue
Jun 29, 2026
|
🦢 Load Test Results Goose Attack ReportPlan Overview
Request Metrics
Response Time Metrics
Status Code Metrics
Transaction Metrics
Scenario Metrics
|
gtema
removed this pull request from the merge queue due to a manual request
Jun 29, 2026
gtema
added this pull request to the merge queue
Jun 29, 2026
|
| Branch | mapping_race |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result nanoseconds (ns) (Result Δ%) | Upper Boundary nanoseconds (ns) (Limit %) |
|---|---|---|---|
| Command_Serde/apply/remove | 📈 view plot 🚷 view threshold | 128,170.00 ns(-35.91%)Baseline: 199,973.62 ns | 945,215.25 ns (13.56%) |
| Command_Serde/apply/set | 📈 view plot 🚷 view threshold | 137,280.00 ns(-29.88%)Baseline: 195,779.95 ns | 848,693.45 ns (16.18%) |
| Command_Serde/pack/delete | 📈 view plot 🚷 view threshold | 129.07 ns(+7.72%)Baseline: 119.82 ns | 143.40 ns (90.01%) |
| Command_Serde/pack/delete_index | 📈 view plot 🚷 view threshold | 113.31 ns(+2.50%)Baseline: 110.55 ns | 133.50 ns (84.87%) |
| Command_Serde/pack/set | 📈 view plot 🚷 view threshold | 202.57 ns(+4.83%)Baseline: 193.23 ns | 235.20 ns (86.13%) |
| Command_Serde/pack/set_index | 📈 view plot 🚷 view threshold | 113.79 ns(+2.79%)Baseline: 110.71 ns | 133.51 ns (85.23%) |
| Command_Serde/unpack/delete | 📈 view plot 🚷 view threshold | 191.59 ns(+0.98%)Baseline: 189.73 ns | 234.51 ns (81.70%) |
| Command_Serde/unpack/delete_index | 📈 view plot 🚷 view threshold | 154.95 ns(-4.40%)Baseline: 162.08 ns | 202.60 ns (76.48%) |
| Command_Serde/unpack/set | 📈 view plot 🚷 view threshold | 277.98 ns(+10.82%)Baseline: 250.85 ns | 309.75 ns (89.74%) |
| Command_Serde/unpack/set_index | 📈 view plot 🚷 view threshold | 165.40 ns(+3.16%)Baseline: 160.34 ns | 199.15 ns (83.05%) |
| Payload_encryption/pack/remove_cmd | 📈 view plot 🚷 view threshold | 118.59 ns(+0.03%)Baseline: 118.55 ns | 152.36 ns (77.84%) |
| Payload_encryption/pack/set_cmd | 📈 view plot 🚷 view threshold | 206.15 ns(-3.55%)Baseline: 213.73 ns | 285.39 ns (72.23%) |
| Payload_encryption/unpack/remove_cmd | 📈 view plot 🚷 view threshold | 207.10 ns(+3.10%)Baseline: 200.87 ns | 249.66 ns (82.95%) |
| Payload_encryption/unpack/set_cmd | 📈 view plot 🚷 view threshold | 311.93 ns(+18.61%)Baseline: 262.99 ns | 325.41 ns (95.86%) |
| Raft_1Node_Latency/prefix/1node | 📈 view plot 🚷 view threshold | 2,472,600.00 ns(-23.76%)Baseline: 3,243,248.12 ns | 6,674,180.65 ns (37.05%) |
| Raft_1Node_Latency/read/1node | 📈 view plot 🚷 view threshold | 1,476.60 ns(+98.59%)Baseline: 743.54 ns | 1,588.43 ns (92.96%) |
| Raft_1Node_Latency/remove/1node | 📈 view plot 🚷 view threshold | 367,410.00 ns(-24.61%)Baseline: 487,366.88 ns | 2,112,518.74 ns (17.39%) |
| Raft_1Node_Latency/write/1node | 📈 view plot 🚷 view threshold | 389,300.00 ns(-15.39%)Baseline: 460,118.12 ns | 1,561,936.46 ns (24.92%) |
| build_snapshot/default | 📈 view plot 🚷 view threshold | 114,970.00 ns(+17.30%)Baseline: 98,017.05 ns | 168,300.54 ns (68.31%) |
| fernet token/project | 📈 view plot 🚷 view threshold | 1,422.00 ns(+1.98%)Baseline: 1,394.37 ns | 1,619.01 ns (87.83%) |
| get_data_keyspace | 📈 view plot 🚷 view threshold | 0.31 ns(-1.75%)Baseline: 0.32 ns | 0.38 ns (83.07%) |
| get_db | 📈 view plot 🚷 view threshold | 0.31 ns(-1.42%)Baseline: 0.32 ns | 0.38 ns (83.40%) |
| get_fernet_token_timestamp/project | 📈 view plot 🚷 view threshold | 158.19 ns(+8.57%)Baseline: 145.70 ns | 178.38 ns (88.68%) |
| get_keyspace | 📈 view plot 🚷 view threshold | 4.37 ns(-12.39%)Baseline: 4.99 ns | 10.06 ns (43.41%) |
Open
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.
The ephemeral authentication path in authenticate_ephemeral returned
AuthenticationResult without authorization, forcing a second storage
read via get_mapping_provider().get_virtual_user(). Since get_by_key
does not enforce Raft linearizability for tier-0 data, the read could
return stale state under concurrent requests.
Derive AuthzInfo directly from match_result.authorizations and attach
it to the authentication result, eliminating the second read entirely.
Signed-off-by: Artem Goncharov artem.goncharov@gmail.com