{"record":{"id":"7ccf10ac7ce1ac86","repo":"cube-js/cube","slug":"query-cancelled-7ccf10","errorCode":null,"errorMessage":"Query cancelled","messagePattern":"Query cancelled","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-mongobi-driver/src/MongoBIDriver.ts","lineNumber":169,"sourceCode":"    let cancelled = false;\n    const cancelObj: any = {};\n    const promise: any = connectionPromise.then(conn => {\n      cancelObj.cancel = async () => {\n        cancelled = true;\n        await self.withConnection(async processConnection => {\n          const processRows: any = await processConnection.promise().query({\n            sql: 'SHOW PROCESSLIST'\n          });\n          await Promise.all(processRows.filter((row: any) => row.Time >= 599)\n            .map((row: any) => processConnection.promise().query({\n              sql: `KILL ${row.Id}`\n            })));\n        });\n      };\n      return fn(conn)\n        .then(res => this.pool.release(conn).then(() => {\n          if (cancelled) {\n            throw new Error('Query cancelled');\n          }\n          return res;\n        }))\n        .catch((err) => this.pool.release(conn).then(() => {\n          if (cancelled) {\n            throw new Error('Query cancelled');\n          }\n          throw err;\n        }));\n    });\n    promise.cancel = () => cancelObj.cancel();\n    return promise;\n  }\n\n  public async testConnection() {\n    // eslint-disable-next-line no-underscore-dangle\n    const conn: Connection = await (<any> this.pool)._factory.create();\n    try {","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-mongobi-driver/src/MongoBIDriver.ts#L151-L187","documentation":"In MongoBIDriver.withConnection, cancelObj.cancel flips a `cancelled` flag and issues SHOW PROCESSLIST / KILL of long-running (Time >= 599s) connections; after cancellation the pending query promise is rejected with 'Query cancelled'. It means the orchestrator (or a timeout) actively aborted the in-flight Mongo BI query, not that the query itself failed — downstream code should treat it as an expected cancellation and typically retry or propagate ContinueWait-like semantics rather than surfacing it as a data error.","triggerScenarios":"Thrown at packages/cubejs-mongobi-driver/src/MongoBIDriver.ts:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This fires when cancelObj.cancel() was invoked and the query fn checks the cancelled flag before returning results; no action needed if cancellation was intentional","If queries are cancelled unexpectedly, inspect who calls cancel (query timeout, client abort) and raise continueWaitTimeout/orchestrator timeouts","If the KILL via SHOW PROCESSLIST failed, verify the BI user has PROCESS/KILL privileges on the MongoDB BI connector"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}