Skip to content

Make storage layer context aware

bc5f13a
Select commit
Loading
Failed to load commit list.
Draft

[TT-15954] Make org session fetch non-blocking #7480

Make storage layer context aware
bc5f13a
Select commit
Loading
Failed to load commit list.
probelabs / Visor: performance failed Nov 6, 2025 in 5m 27s

🚨 Check Failed

performance check failed because fail_if condition was met.

Details

📊 Summary

  • Total Issues: 2
  • Error Issues: 2

🔍 Failure Condition Results

❌ Failed Conditions

  • global_fail_if: Global failure condition met
    • ⚠️ Severity: Error

🐛 Issues by Category

⚡ Performance (1)

  • gateway/middleware.go:347 - The fetchOrgSessionWithTimeout function spawns a goroutine with a timeout, but the context is not propagated to all underlying storage client calls (LDAP, RPC, MDCB). If a backend is unresponsive, the goroutine will block indefinitely and leak, even after the parent function times out. A sustained backend issue could lead to resource exhaustion and a gateway crash.

🧠 Logic (1)

  • system:0 - Global failure condition met

Powered by Visor from Probelabs

💡 TIP: You can chat with Visor using /visor ask <your question>

Annotations

Check failure on line 386 in gateway/middleware.go

See this annotation in the file changed.

@probelabs probelabs / Visor: performance

performance Issue

The `fetchOrgSessionWithTimeout` function spawns a goroutine with a timeout, but the context is not propagated to all underlying storage client calls (LDAP, RPC, MDCB). If a backend is unresponsive, the goroutine will block indefinitely and leak, even after the parent function times out. A sustained backend issue could lead to resource exhaustion and a gateway crash.
Raw output
To fix this leak, the `context` must be propagated down to the underlying network calls in all `storage.Handler` implementations. For `gateway/rpc_storage_handler.go`, update the HTTP client logic to use `http.NewRequestWithContext()`. For `gateway/ldap_auth_handler.go` and `storage/mdcb_storage.go`, the underlying client libraries must be updated to support context-based cancellation. If a storage backend's client library does not support cancellation, this timeout pattern is unsafe and should be conditionally disabled for that backend.