Fork me on GitHub
#sql
<
2021-08-10
>
jmckitrick22:08:58

I have a Heroku app and the backend db has been updated from postgres 9.x to 13.x. And now, even after updating jdbc to 0.7.12, I am seeing errors like this:

jmckitrick22:08:00

2021-08-10T22:40:06.634893+00:00 app[web.1]: WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResour
cePool@22e131dc is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2021-08-10T22:40:06.637060+00:00 app[web.1]: Aug 10, 2021 10:40:06 PM com.mchange.v2.resourcepool.BasicResourcePool               
2021-08-10T22:40:06.637061+00:00 app[web.1]: WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@14790d07 
-- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed mo
re than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:                              
2021-08-10T22:40:06.637062+00:00 app[web.1]: org.postgresql.util.PSQLException: This ResultSet is closed.  

jmckitrick22:08:04

Any thoughts?

Darin Douglass23:08:55

did you update your PG driver too?

jmckitrick23:08:32

:man-facepalming::skin-tone-2:

🙂 2
jmckitrick23:08:17

Like I said, it’s an ancient app 😉

jmckitrick23:08:36

You’d think there’d be an error message somewhere suggesting incompatibility or something….

seancorfield23:08:07

(updating java.jdbc isn't going to help you there but it's nice to be on the most recent version anyway 🙂 )

jmckitrick23:08:02

Well, it looks like everything is fixed!

jmckitrick23:08:23

So it seems I was updating the wrong thing.

jmckitrick23:08:04

Actually, if that’s the case, the next app I’m fixing should be much simpler… I had to write a macro to handle the with-connection change in a reasonable time, but that might not be necessary… stay tuned…

seancorfield23:08:23

The PG driver has gone through major changes over time...

seancorfield23:08:41

"the with-connection change" @jmckitrick?

jmckitrick23:08:21

Yes, the jdbc I was using was so old, when I updated (apparently mistakenly) I had to change all the SQL calls to pass the connection spec instead of using with-connection

seancorfield23:08:48

Wow, that must have been very old 👀

jmckitrick23:08:59

Yes, it really was. And running fine all this time.

jmckitrick23:08:30

Back when Clojure was unofficially supported on Heroku…

jmckitrick23:08:17

git tells me that repo first commit was.. Dec 29, 2012

seancorfield23:08:26

A testament to Clojure's stability I guess. The java.jdbc API last changed about 5 1/2 years ago, removing functions that had been deprecated for "years".

jmckitrick23:08:07

I assume with-connection was one of them? 😜

seancorfield23:08:30

We still have some code written for Clojure 1.3 that is still running unchanged (although our more recent code is already taking advantage of 1.11 Alpha 1)

seancorfield23:08:53

Changes in 0.3.0-rc1

Deprecate db-transaction (new in 0.3.0) in favor of with-db-transaction JDBC-81.
Add with-db-metadata macro and metadata-result function to make it easier to work with SQL metadata JDBC-80.
Add with-db-connection macro to make it easier to run groups of operations against a single open connection JDBC-79.
That was released at the end of 2013 🙂

😲 2
jmckitrick23:08:54

I’m out of the loop… where’s the list of exciting goodies in 1.11?

seancorfield23:08:46

https://clojure.org/releases/devchangelog -- the named argument/hash map stuff is the only change so far in Clojure itself.

seancorfield23:08:14

The CLI tooling / tools.build has seen a lot of innovation recently 🙂

jmckitrick23:08:35

Oh yes, that was Fogus’ doing….

seancorfield23:08:35

Are you keeping up with the CLI stuff?

jmckitrick23:08:11

Actually, no… I’m more focused on CIDER stuff

jmckitrick23:08:37

But we use tools.deps at our shop

jmckitrick23:08:10

Is there a similar change log for CLI tools?