Timeout for GraphQL query groupVulnerabilities

https://sentry.gitlab.net/gitlab/gitlabcom/issues/4034697/?referrer=gitlab_plugin

PG::QueryCanceled: ERROR:  canceling statement due to statement timeout

  lib/gitlab/graphql/tracers/timer_tracer.rb:20:in `trace'
    yield
  lib/gitlab/graphql/generic_tracing.rb:48:in `with_labkit_tracing'
    return yield unless Labkit::Tracing.enabled?
  lib/gitlab/graphql/generic_tracing.rb:38:in `platform_trace'
    with_labkit_tracing(tags, &block)
  lib/gitlab/graphql/tracers/logger_tracer.rb:14:in `trace'
    yield
  lib/gitlab/graphql/tracers/metrics_tracer.rb:13:in `trace'
    result = yield
...
(245 additional frame(s) were not displayed)

ActiveRecord::QueryCanceled: PG::QueryCanceled: ERROR:  canceling statement due to statement timeout

Some details for correlation_id:f0b4742f55fae1712dbfb03a386a8142 (internal link) below.

json.params.value
groupVulnerabilities,
[FILTERED],
query groupVulnerabilities($fullPath: ID!, $before: String, $after: String, $first: Int = 20, $last: Int, $projectId: [ID!], $severity: [VulnerabilitySeverity!], $reportType: [VulnerabilityReportType!], $scanner: [String!], $scannerId: [VulnerabilitiesScannerID!], $state: [VulnerabilityState!], $sort: VulnerabilitySort, $hasIssues: Boolean, $hasResolution: Boolean, $vetEnabled: Boolean = false, $clusterAgentId: [ClustersAgentID!]) {
  group(fullPath: $fullPath) {
    id
    vulnerabilities(
      before: $before
      after: $after
      first: $first
      last: $last
      severity: $severity
      reportType: $reportType
      scanner: $scanner
      scannerId: $scannerId
      state: $state
      projectId: $projectId
      sort: $sort
      hasIssues: $hasIssues
      hasResolution: $hasResolution
      clusterAgentId: $clusterAgentId
    ) {
      nodes {
        ...VulnerabilityFragment
        __typename
      }
      pageInfo {
        ...PageInfo
        __typename
      }
      __typename
    }
    __typename
  }
}

fragment VulnerabilityFragment on Vulnerability {
  id
  title
  state
  severity
  detectedAt
  vulnerabilityPath
  resolvedOnDefaultBranch
  userNotesCount
  falsePositive @include(if: $vetEnabled)
  issueLinks {
    nodes {
      id
      issue {
        id
        iid
        webUrl
        webPath
        title
        state
        __typename
      }
      __typename
    }
    __typename
  }
  identifiers {
    externalType
    name
    __typename
  }
  location {
    ...VulnerabilityLocation
    __typename
  }
  project {
    id
    nameWithNamespace
    __typename
  }
  reportType
  scanner {
    id
    vendor
    __typename
  }
  __typename
}

fragment VulnerabilityLocation on VulnerabilityLocation {
  ... on VulnerabilityLocationClusterImageScanning {
    image
    kubernetesResource {
      agent {
        id
        name
        webPath
        __typename
      }
      __typename
    }
    __typename
  }
  ... on VulnerabilityLocationContainerScanning {
    image
    __typename
  }
  ... on VulnerabilityLocationDependencyScanning {
    blobPath
    file
    __typename
  }
  ... on VulnerabilityLocationSast {
    blobPath
    file
    startLine
    __typename
  }
  ... on VulnerabilityLocationSecretDetection {
    blobPath
    file
    startLine
    __typename
  }
  ... on VulnerabilityLocationDast {
    path
    __typename
  }
  __typename
}

fragment PageInfo on PageInfo {
  hasNextPage
  hasPreviousPage
  startCursor
  endCursor
  __typename
}
,
{"operationName"=>"groupVulnerabilities", "variables"=>"[FILTERED]", "query"=>"query groupVulnerabilities($fullPath: ID!, $before: String, $after: String, $first: Int = 20, $last: Int, $projectId: [ID!], $severity: [VulnerabilitySeverity!], $reportType: [VulnerabilityReportType!], $scanner: [String!], $scannerId: [VulnerabilitiesScannerID!], $state: [VulnerabilityState!], $sort: VulnerabilitySort, $hasIssues: Boolean, $hasResolution: Boolean, $vetEnabled: Boolean = false, $clusterAgentId: [ClustersAgentID!]) {\n  group(fullPath: $fullPath) {\n    id\n    vulnerabilities(\n      before: $before\n      after: $after\n      first: $first\n      last: $last\n      severity: $severity\n      reportType: $reportType\n      scanner: $scanner\n      scannerId: $scannerId\n      state: $state\n      projectId: $projectId\n      sort: $sort\n      hasIssues: $hasIssues\n      hasResolution: $hasResolution\n      clusterAgentId: $clusterAgentId\n    ) {\n      nodes {\n        ...VulnerabilityFragment\n        __typename\n      }\n      pageInfo {\n        ...PageInfo\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment VulnerabilityFragment on Vulnerability {\n  id\n  title\n  state\n  severity\n  detectedAt\n  vulnerabilityPath\n  resolvedOnDefaultBranch\n  userNotesCount\n  falsePositive @include(if: $vetEnabled)\n  issueLinks {\n    nodes {\n      id\n      issue {\n        id\n        iid\n        webUrl\n        webPath\n        title\n        state\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n  identifiers {\n    externalType\n    name\n    __typename\n  }\n  location {\n    ...VulnerabilityLocation\n    __typename\n  }\n  project {\n    id\n    nameWithNamespace\n    __typename\n  }\n  reportType\n  scanner {\n    id\n    vendor\n    __typename\n  }\n  __typename\n}\n\nfragment VulnerabilityLocation on VulnerabilityLocation {\n  ... on VulnerabilityLocationClusterImageScanning {\n    image\n    kubernetesResource {\n      agent {\n        id\n        name\n        webPath\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n  ... on VulnerabilityLocationContainerScanning {\n    image\n    __typename\n  }\n  ... on VulnerabilityLocationDependencyScanning {\n    blobPath\n    file\n    __typename\n  }\n  ... on VulnerabilityLocationSast {\n    blobPath\n    file\n    startLine\n    __typename\n  }\n  ... on VulnerabilityLocationSecretDetection {\n    blobPath\n    file\n    startLine\n    __typename\n  }\n  ... on VulnerabilityLocationDast {\n    path\n    __typename\n  }\n  __typename\n}\n\nfragment PageInfo on PageInfo {\n  hasNextPage\n  hasPreviousPage\n  startCursor\n  endCursor\n  __typename\n}\n"}

json.exception.sql

/*application:web,correlation_id:f0b4742f55fae1712dbfb03a386a8142,endpoint_id:GraphqlController#execute,db_config_name:main_replica*/ SELECT "vulnerability_reads".* FROM "vulnerability_reads" WHERE "vulnerability_reads"."namespace_id" IN (SELECT "namespaces"."id" FROM "namespaces" WHERE "namespaces"."type" = $1 AND (traversal_ids @> ($2))) AND "vulnerability_reads"."report_type" IN ($3, $4, $5, $6, $7, $8, $9, $10) AND "vulnerability_reads"."state" IN ($11, $12) AND "vulnerability_reads"."resolved_on_default_branch" = $13 ORDER BY "vulnerability_reads"."severity" DESC, "vulnerability_reads"."vulnerability_id" DESC LIMIT $14
Edited by Thiago Figueiró