Uploaded image for project: 'Clair'
  1. Clair
  2. CLAIRDEV-232

Postgres encoding plan for claircore types not found

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • claircore-1.5.48
    • None

      Some ACS engineers are noticing this error when starting the Matcher service:

      failed to finish batch vulnerability insert: error building query \n\t\tINSERT INTO vuln (\n\t\t\thash_kind, hash,\n\t\t\tname, updater, description, issued, links, severity, normalized_severity,\n\t\t\tpackage_name, package_version, package_module, package_arch, package_kind,\n\t\t\tdist_id, dist_name, dist_version, dist_version_code_name, dist_version_id, dist_arch, dist_cpe, dist_pretty_name,\n\t\t\trepo_name, repo_key, repo_uri,\n\t\t\tfixed_in_version, arch_operation, version_kind, vulnerable_range\n\t\t) VALUES (\n\t\t  $1, $2,\n\t\t  $3, $4, $5, $6, $7, $8, $9,\n\t\t  $10, $11, $12, $13, $14,\n\t\t  $15, $16, $17, $18, $19, $20, $21, $22,\n\t\t  $23, $24, $25,\n\t\t  $26, $27, $28, COALESCE($29, VersionRange('{}', '{}', '()'))\n\t\t)\n\t\tON CONFLICT (hash_kind, hash) DO NOTHING;: failed to encode args[28]: unable to encode &claircore.Range{Lower:claircore.Version{Kind:\"\", V:[10]int32{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, Upper:claircore.Version{Kind:\"\", V:[10]int32{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}} into text format for unknown type (OID 16934): cannot find encode plan
      

      hdonnay mentioned this could be due to the pgx connection being created before the migrations ran and hit this case: https://github.com/quay/claircore/blob/bcc2f4ab7201a0787134330ce80e9ce97672657d/datastore/postgres/types/version.go#L37
      Indeed, it looks like the claircore's current implementation first requires a database connection that will register the types, then run the migrations (ostensibly without attempting to register the types again).

              Unassigned Unassigned
              rh-ee-blugo Brad Lugo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: