You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, I have this reporting engine I'm writing using cube.js, and I started writing some integration tests which:
Write some data to the database
Start a new cube.js instance
Run a query to make sure we get back sensible data
Close the cube.js server.
This works, but after the test runs, while other tests are running, I get a bunch of errors like:
Error: Cannot use a pool after calling end on the pool
at QueryQueue.parseResult (node_modules/@cubejs-backend/query-orchestrator/orchestrator/QueryQueue.js:97:13)
at QueryQueue.executeInQueue (node_modules/@cubejs-backend/query-orchestrator/orchestrator/QueryQueue.js:86:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at node_modules/@cubejs-backend/query-orchestrator/orchestrator/QueryCache.js:250:17
To Reproduce
I have a test case that does:
const server = new CubejsServer();
try {
// Run a query against the server.
} finally {
server.close();
}
I tried to reproduce this by running cubejs create hello-world -d postgres, and then editing index.js to look like:
constCubejsServer=require('@cubejs-backend/server');constCubejsClient=require('@cubejs-client/core');functioncubeJsLogger(msg,params){if(params.error){console.log(`${msg}\n${params.error}`);}}constserver=newCubejsServer({logger: cubeJsLogger,});Promise.resolve().then(async()=>{const{ port }=awaitserver.listen();console.log(`🚀 Cube.js server is listening on ${port}`);constcubeClient=newCubejsClient.default('faketoken',{apiUrl: `http://localhost:${port}/cubejs-api/v1`,});constresultSet=awaitcubeClient.load({measures: ['Orders.count'],timeDimensions: [],filters: [],});console.log('******** - Got results');console.log('******** - Shutting down the server');server.close().catch(err=>{console.log(`Close error: ${err.stack}`);});console.log('******** - Wait for a bit...');awaitnewPromise(resolve=>{setTimeout(resolve,10000);});console.log('******** - Done');}).catch(err=>{console.error(err.stack);process.exit(1);});
and this doesn't reproduce it... although instead it reproduced another error. The call to close() fails with:
TypeError: this.externalDriverFactory is not a function
at getExternalDriverFactory (/Users/jwalton/tt/hello-world/node_modules/@cubejs-backend/server-core/core/index.js:427:39)
at OrchestratorApi.releaseDriver (/Users/jwalton/tt/hello-world/node_modules/@cubejs-backend/server-core/core/OrchestratorApi.js:98:28)
at OrchestratorApi.release (/Users/jwalton/tt/hello-world/node_modules/@cubejs-backend/server-core/core/OrchestratorApi.js:92:12)
at /Users/jwalton/tt/hello-world/node_modules/@cubejs-backend/server-core/core/index.js:504:37
at Array.forEach (<anonymous>)
at CubejsServerCore.releaseConnections (/Users/jwalton/tt/hello-world/node_modules/@cubejs-backend/server-core/core/index.js:502:53)
at CubejsServer.close (/Users/jwalton/tt/hello-world/node_modules/@cubejs-backend/server/index.js:108:23)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
-_-
Expected behavior
Server should stop trying to make queries after shutting down. Shutting down server should not error.
Version:
0.18.12
The text was updated successfully, but these errors were encountered:
@jwalton Hey Jason! Thanks for heads up! Later one issue should be fixed now. In terms of tests it means driver somehow is reused. Do you pass any options to CubejsServer at all?
Describe the bug
Basically, I have this reporting engine I'm writing using cube.js, and I started writing some integration tests which:
This works, but after the test runs, while other tests are running, I get a bunch of errors like:
To Reproduce
I have a test case that does:
I tried to reproduce this by running
cubejs create hello-world -d postgres
, and then editing index.js to look like:and this doesn't reproduce it... although instead it reproduced another error. The call to
close()
fails with:-_-
Expected behavior
Server should stop trying to make queries after shutting down. Shutting down server should not error.
Version:
0.18.12
The text was updated successfully, but these errors were encountered: