Skip to content

Temporary error when realizing layers during indexing leaves IndexReport in an unrecoverable error state #1748

@frostmar

Description

@frostmar

When indexing a digest, an error during "realizing layers" (ie. fetching and unpacking the tar-gz layer data) will cause IndexReport to be persisted with an error state into Postgres. That state is then persistent - claircore won't reattempt indexing even if another index request is made.

It's possible to cludge in a workaround that inspects the index response or fetches an IndexReport after indexing, then deletes the report for that digest before retrying ... but this is clumsy, couples to the internals of claircore, and has less information about the error to work with.


Example logs

From memory I think in this case the IndexReport ended up with state IndexError.

message:index request start

message:locking attempt

message:locking OK

message:starting scan

message:manifest to be scanned

message:layers fetch start

message:fetching layers

message:layer fetch start

... other layer fetch starts snipped ...

message:layers fetch failure
  error:fetcher: encountered errors: error realizing layer sha256:9dc6ea54f2e2297d66090e7d724af8a0648caef7d7fc589a3da7433470bd9100: unexpected status code: 503 Service Unavailable (body starts: "upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: delayed connect error: Connection refused")

message:layers fetch done
  state:FetchLayers

message:error during scan
  error:failed to fetch layers: fetcher: encountered errors: error realizing layer sha256:9dc6ea54f2e2297d66090e7d724af8a0648caef7d7fc589a3da7433470bd9100: unexpected status code: 503 Service Unavailable (body starts: "upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: delayed connect error: Connection refused")

message:index request done

message:http error response
  code:500
  error:failed to start scan: failed to fetch layers: fetch

message:handled HTTP request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions