[Cppcms-users] C++DB + MySQL disconnect
Brought to you by:
artyom-beilis
From: Jon F. <jon...@jf...> - 2021-03-25 18:23:38
|
This isn't specifically a C++CMS query. I'm using C++DB with C++CMS and FLTK to query a MariaDB server. With other languages and tools I can tell the client library to auto-reconnect and it does. From the C++DB docs I should be able to append ";opt_reconnect=1" to the connection string and it should auto-reconnect. But this has not been reliable, where in other tools it is. My test FLTK app, which doesn't use a connection pool, will fail after the idle timeout set in the server (1hr in this case) and *never* reconnect. My C++CMS apps which use connection pooling kind of work but I still get random 500s and logs telling me "MySQL went away". Fortunately it seems to mostly re-connect if I hit another page and then come back to the one that broke. But I *HATE* random fails in my projects. I'm not a "80% of the time it works 100% of the time" kind of guy. So! Is there an easy fix for this? Am I misinterpreting the docs and writing that option wrong? Or do I just need to dig into the source and force that client option? I'm not even sure why its an option. ;-) Anyhow I can't go live with a real C++CMS website and have this happening. Versions: C++DB: 0.3.1 MariaDB: 10.0.38 & 10.2.25 G++: 4.9.2 TIA, Jon -- Sent from my Devuan Linux workstation -- https://devuan.org/ "Init Freedom", Yeah! Jon Foster JF Possibilities, Inc. jo...@jf... |