-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Milestone
Description
SQLChannel::setProperty() in Data/src/SQLChannel.cpp only creates the log directory when the path is relative:
else if (name == "directory")
{
std::string dir = value;
if (!Path(File(dir).path()).isAbsolute())
{
Path d(dir);
dir = d.makeDirectory().makeAbsolute().toString();
File f(dir);
if (!f.exists()) f.createDirectories();
}
_directory = dir;
}
When no directory is explicitly set, SQLChannel uses Path::tempHome() as the default, which returns an absolute path (~/.local/tmp/ on Linux). Since this path is absolute, the createDirectories() call is skipped.
Consequence:
If ~/.local/tmp/ does not exist (which is common—it's a non-standard path that most systems don't create by default):
- FileChannel::open() fails with ENOENT when trying to write to ~/.local/tmp/*.log.sql
- SQLChannel attempts to log this failure back into its own message queue
- The background worker thread tries to flush this message, fails again, logs again--never draining the queue
- SQLChannel::stop() waits indefinitely for the worker thread to finish
- The program hangs
To Reproduce
- Run the DataTest::testSQLChannel test in an environment where $HOME/.local/tmp/ does not exist.
- It hangs.
Suggested fix:
Remove the isAbsolute() check so that directories are created regardless of whether the path is relative or absolute:
else if (name == "directory")
{
std::string dir = value;
Path d(dir);
dir = d.makeDirectory().makeAbsolute().toString();
File f(dir);
if (!f.exists()) f.createDirectories();
_directory = dir;
}
Affected versions:
Introduced in 1.9.0 (commit 73ec4e8). Still present in 1.14.2.
Please add relevant environment information:
- Linux
- POCO Versions 1.9.0 to 1.14.2
Reactions are currently unavailable