From the stack traces of the Derby engine, it appears that something causes the utility to fail after the database was frozen and neither the shutdown hook nor the try/finally unfroze the database. So after that point, the database was effectively locked up. The system was still operating and connections were being made trying to access the database exhausting all of the connections.
So I was thinking that maybe the database engine should have some sort of protection if this were to happen. Maybe the database engine should automatically unfreeze the database if the connection that freezes the database terminates/closes. Or maybe a timer to be added to the freeze command to automatically unfreeze the database after the fact.
I am thinking this because I was told on a previous emailing when trying to build this utility totally from a script point of view using IJ to freeze the database, SH to perform the ZFS snapshot and IJ to unfreeze the database that it was not expected that the freeze/unfreeze would be done from separate connections. I fact I ran into a problem with the utility at that point where the IJ connection to unfreeze could not be created because the database was frozen.
So I guess is there ever a use case that would require a database to be frozen and not unfrozen before the connection is closed/lost?