-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Expected behavior
When using the SQLite connector it should free resources in a timely fashion.
Actual behavior
Simply creating a SQLite session to a local file then closing the session will result in a 20 sec delay on Windows when destroying the session. This is noticeable when using the SQLite data connector from a Windows DLL and it hangs for 20 secs on unloading.
Steps to reproduce the problem
Create a Windows DLL containing the following code:
Poco::Data::SQLite::Connector::registerConnector();
Poco::Data::Session* session = new Poco::Data::Session("SQLite", <some local db>);
session->close();
delete session;
POCO version
Reproduced in POCO 1.8.1
Compiler and version
Visual C++ with v120 runtimes
Operating system and version
Windows 10
Other relevant information
This does not appear to be a connect or login timeout as I can see the connect succeed immediately, it appears to be an issue with how the SQLite connector is using thread pooling. The SQLite connector creates two thread pool threads and when the SQLite session is closed and destroyed, the thread pool is left to clean itself up and internally each pooled thread has a 10 second wait timeout before deletion occurs. It would be better if the SQLite connector could signal the threads when the session is closed to allow these threads to exit without waiting for timeout to occur.