server: guard nil liveParams when no orchestrators available for AI request#3939
server: guard nil liveParams when no orchestrators available for AI request#3939SAY-5 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis pull request fixes a nil-pointer panic in the AI request handler that occurred when processing non-live AI requests with no available orchestrators. The fix adds a nil-check before accessing ChangesNon-live AI request nil-pointer panic fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #3917. A non-live AI request (e.g.
audio-to-text) panics with a nil-pointer dereference instead of returning an error when no orchestrators are available, for example when every eligible orchestrator is rejected by the per-capability max price filter and--ignoreMaxPriceIfNeeded=false.In
processAIRequest, theresp == nil("no orchestrators available") branch builds astream_tracemonitor event that unconditionally dereferencesparams.liveParams.streamID,params.liveParams.pipelineIDandparams.liveParams.requestID.liveParamsis only set for realtime video pipelines and is nil for all other AI requests, so the dereference panics and the gateway closes the connection without an HTTP response (curl: (52) Empty reply from server).Changes
stream_traceevent behindparams.liveParams != nil, mirroring the existing nil guards used elsewhere in the same function. Non-live requests now return the existingServiceUnavailableError("no orchestrators available").processAIRequestwith an empty session pool and nilliveParams, asserting aServiceUnavailableErroris returned rather than a panic.Test plan
go test ./server/ -run Test_processAIRequest_NoOrchestrators_NonLive -raceNote: I could not run the server package test suite locally because building it requires the patched LPMS ffmpeg toolchain (the system ffmpeg here is incompatible with the cgo bindings). The change is gofmt-clean and relies only on existing symbols; please rely on CI to validate the build.
Summary by CodeRabbit