We’re getting some very rare strange query results that look like our Lucee code isn’t thread safe.
(an email occasionally getting sent to a different distribution list). I continue poring thru the code and believe it’s okay. And I’m willing to share it if folks want to pore thru it with me but at the moment I’m entertaining other possible theories.
This is in GCP Cloud Run which has CPU allocation ONLY during the request. One theory I’m developing is that database connection pools that are assumed to be maintained between requests are getting mangled because the CPU won’t necessarily handle any off-request activity.
So - I’m thinking I could ask the system to check any database connections it gets from it’s assumed valid connection pool. In other words, I’m thinking that the ‘validate’ flag set to true on a datasource would do exactly this. But I can’t find any docs anywhere that confirm or deny this.
I don’t follow your logic here tho, are you saying the wrong results are being returned for a query? That can’t / shouldn’t be affected by the connection pool, either there is a db connection or it isn’t.
@Brian_Harcourt : What does ‘validate’ do in database config?
… ask the system to check any database connections it gets from it’s assumed valid connection pool. In other words, I’m thinking that the ‘validate’ flag set to true on a datasource would do exactly this.
I think the answer you’ve given to your own question is correct.
Yeah - no - it was my poorly scoped variables. I was grasping at straws. A bit of thinking kept raising @Zackster’s point.
I still wonder about the question - tho I imagine it out of scope for this thread; What exactly is ‘validate’? Does it send some kind of system query (‘SELECT getdate()’)? to validate? And further, what does happen to a connection pool when the CPU stops handling threads between requests? All answers (I assume) would require a more detailed knowledge of connection pooling. One day, maybe I’ll have time to learn.
I think that the Validate setting enables the JDBC driver API call, isValid(). The call checks whether the connection has not been closed and is still valid.
Does it send some kind of system query (‘SELECT getdate()’)? to validate?
Yes, I think the JDBC driver uses an in-built query for validation.
…what does happen to a connection pool when the CPU stops handling threads between requests?
The connection pool is a cache of database connection objects. As such it is separate from request-thread handling in the application. Again, this is just my take on the questions.