Skip to content

Optimization panic status cleanup - #7783

Merged
xzfc merged 1 commit into
devfrom
optimization-panic
Dec 16, 2025
Merged

xzfc merged 1 commit into
devfrom
optimization-panic

Conversation

@xzfc

@xzfc xzfc commented Dec 15, 2025

Copy link
Copy Markdown
Member

Depends on #7766 because it touches the same part of code.

Problem

When an optimization task panics, its telemetry reports are stuck as never-ending "status": "optimizing":

curl '127.0.0.1:6333/telemetry?details_level=10' \
| jq '.result.collections.collections[].shards[].local.optimizations'
{
  "status": {
    "error": "Service internal error: Optimization task panicked: Simulated panic for testing purposes"
  },
  "optimizations": {
    "count": 0,
    "fail_count": 2,
    "total_duration_micros": 0,
    "last_responded": "2025-12-15T22:16:29.440Z"
  },
  "log": [
    {
      "name": "indexing",
      "segment_ids": [
        1,
        2
      ],
      "status": "optimizing", // ⚠️ should be "error"
      "start_at": "2025-12-15T22:16:29.422213214Z",
      "end_at": null          // ⚠️ should be non-null
    },
    {
      "name": "indexing",
      "segment_ids": [
        3,
        0
      ],
      "status": "optimizing", // ⚠️
      "start_at": "2025-12-15T22:16:28.987590070Z",
      "end_at": null          // ⚠️
    }
  ]
}

Additionally, the optimizing panic handler is not reliable. Its StoppableTaskHandle::panic_handler relies on the caller to call join_and_handle_panic explicitly. (what if the supposed caller will be cancelled/skipped due to errors/early return).

And it's awkward to use: in order to "jump" into it, the stoppable task calls panic!(). But how to pass a variable to the panic handler other than string (e.g. TrackerStatus)?

Solution

Remove panic handling from StoppableTaskHandle, instead use std::panic::catch_unwind. Handle all cases under a single match so the compiler won't let us to forget to provide a value for tracker_handle.update() or report_optimizer_error().

Also, reliable completion handling would be useful for tracking currently optimized segments.

@xzfc
xzfc requested review from generall and timvisee December 15, 2025 22:39
@xzfc
xzfc force-pushed the optimization-panic branch from 15c7f81 to 2be0aa4 Compare December 15, 2025 22:52
Base automatically changed from tracker-register to dev December 16, 2025 18:38
@xzfc
xzfc merged commit 709a3b9 into dev Dec 16, 2025
@xzfc
xzfc deleted the optimization-panic branch December 16, 2025 19:24
@qdrant qdrant deleted a comment from coderabbitai Bot Dec 17, 2025
timvisee pushed a commit that referenced this pull request Dec 18, 2025
@timvisee timvisee mentioned this pull request Dec 19, 2025
This was referenced Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants