bluesky-social / indigo

Go source code for Bluesky's atproto services.
https://atproto.com
Apache License 2.0
920 stars 120 forks source link

Sonar is crashing due to an invalid memory address or nil pointer dereference #857

Open jrevillas opened 2 days ago

jrevillas commented 2 days ago

After running for a few days, my Sonar instance is crashing with the following error:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xa19ec0]

goroutine 68 [running]:
github.com/bluesky-social/indigo/sonar.(*Sonar).HandleRepoCommit(0x4000380300, {0xe8f160, 0x4000a6aa20}, 0x40007d5970)
    /app/sonar/sonar.go:230 +0xa60
github.com/bluesky-social/indigo/sonar.(*Sonar).HandleStreamEvent(0x4000380300, {0xe8f198, 0x400048bdb0}, 0x40007cd9e0)
    /app/sonar/sonar.go:111 +0x1130
github.com/bluesky-social/indigo/events/schedulers/sequential.(*Scheduler).AddWork(0x40000b4480, {0xe8f198, 0x400048bdb0}, {0x78f?, 0x60?}, 0x40007cd9e0)
    /app/events/schedulers/sequential/sequential.go:51 +0x70
github.com/bluesky-social/indigo/events.HandleRepoStream({0xe8f198?, 0x400048a140?}, 0x4000316580, {0xe878b0, 0x40000b4480})
    /app/events/consumer.go:202 +0x618
main.Sonar.func5()
    /app/cmd/sonar/main.go:200 +0xb0
created by main.Sonar in goroutine 1
    /app/cmd/sonar/main.go:197 +0xaa0

The current implementation (feceb364) seems to be unable to process a commit:

$ cat sonar_cursor.json | jq .
{
  "last_seq": 838239253,
  "last_seq_processed_at": "2024-11-29T17:47:47.946669887Z"
}

As a result, Sonar is unable to recover and make progress on the next run because the cursor is still pointing at a commit it can't process.

jrevillas commented 2 days ago

I just found the problematic repository: did:plc:5hdeww3gu2q2cqcnkmtiesg2.