ajanata / PretendYoureXyzzy

A web clone of the card game Cards Against Humanity.
https://pretendyoure.xyz/zy
BSD 2-Clause "Simplified" License
1.24k stars 396 forks source link

Hibernate: avoid potential deadlock on c3p0 #235

Open mokomull opened 4 years ago

mokomull commented 4 years ago

If StartGameHandler takes the last connection available in the c3p0 pool, then Game.start() will block inside sessionProvider.get(). But since this is nested within, StartGameHandler never gets to the finally block where it releases its connection.

Testing done

mvn clean package war:war, ran a local stress test and I am no longer seeing Tomcat HTTP threads stuck inside AjaxHandler.