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
// Node.js only have 4 background threads by default, oracledb needs one by connection
if (this.driver) {
process.env.UV_THREADPOOL_SIZE = process.env.UV_THREADPOOL_SIZE || 1;
process.env.UV_THREADPOOL_SIZE =
parseInt(process.env.UV_THREADPOOL_SIZE) + this.driver.poolMax;
}
If the libuv threadpool has been initialized before this code is executed, this does not have the desired effect as UV_THREADPOOL_SIZE is only read once, when libuv initializes the threadpool. I don't think it is correct for the knex oracle dialect to do this. First of all because changing UV_THREADPOOL_SIZE at an arbitrary time during runtime is unreliable, but also because it is something for the actual oracle driver to work out.
I think the knex oracle driver should limit itself to logging a debug message if (UV_THREADPOOL_SIZE || 4) < this.driver.poolMax.
Background: This is not a theoretical problem. It was discovered precisely because the code above was executed too late to have an effect in the project that I am working on.
The text was updated successfully, but these errors were encountered:
I agree that this is something that should be investigated further. I'm also concerned about how this code will behave in multi-client / multi-pool scenarios. (Speaking of which... the (UV_THREADPOOL_SIZE || 4) < this.driver.poolMax check probably would not be sufficient in this scenario. The check would work for each client individually, but not collectively)
lib/dialects/oracledb/index.js has this code:
If the libuv threadpool has been initialized before this code is executed, this does not have the desired effect as UV_THREADPOOL_SIZE is only read once, when libuv initializes the threadpool. I don't think it is correct for the knex oracle dialect to do this. First of all because changing UV_THREADPOOL_SIZE at an arbitrary time during runtime is unreliable, but also because it is something for the actual oracle driver to work out.
I think the knex oracle driver should limit itself to logging a debug message if
(UV_THREADPOOL_SIZE || 4) < this.driver.poolMax
.Background: This is not a theoretical problem. It was discovered precisely because the code above was executed too late to have an effect in the project that I am working on.
The text was updated successfully, but these errors were encountered: