Skip to content

Gateway panics with nil pointer dereference when no AI orchestrators are available #3867

@chrishobcroft

Description

@chrishobcroft

Description

When running a gateway and making a text-to-image request, if no orchestrators are available in the pool for the requested AI capability, the server panics instead of returning a graceful error response.

Version

Livepeer Node version: 0.8.9

Steps to Reproduce

  1. Run gateway: ./livepeer --network arbitrum-one-mainnet --ethUrl --gateway -aiServiceRegistry
  2. Make a text-to-image request when no orchestrators are serving the model:
    curl -X POST http://localhost:9935/text-to-image
    -H "Content-Type: application/json"
    -d '{"prompt": "a beautiful cyberpunk city at night", "width": 1024, "height": 576}'

Expected Behavior

Return an HTTP error response (e.g., 503 Service Unavailable) with a message indicating no orchestrators are available for the requested capability.

Actual Behavior

Server panics with nil pointer dereference:

refreshing sessions, no orchestrators in pools
http: panic serving 127.0.0.1:40640: runtime error: invalid memory address or nil pointer dereference
goroutine 2199 [running]:
...
github.com/livepeer/go-livepeer/server.processAIRequest(...)
/__w/go-livepeer/go-livepeer/server/ai_process.go:1567 +0x1fb0

Suggested Fix

Add a nil check after session refresh in ai_process.go around line 1567, returning an appropriate error when no orchestrators are available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triagethis issue has not been evaluated yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions