You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently encountered a situation where ksql_open() failed in
split-process mode, but worked fine otherwise. This is not really a bug
in ksql, but I'm reporting it for the benefit of anyone else who runs
into the same issue.
The problem occurs if you run ksql in split-process mode in a chroot
environment that doesn't include a functioning /dev/null device. It is
worth noting that this is what you get by default on OpenBSD if you just
enable slowcgi and drop a statically linked cgi script into
If you check the code of sqlite's robust_open() function (src/os_unix.c),
you will see that it wants to return a file descriptor > 2,
and may call open(2) on /dev/null to accomplish this.
If the latter fails, robust_open() returns an error. This behaviour
interacts badly with the code in the child path of ksql_alloc_child(),
which closes stdin and stdout. Without a functioning /dev/null, sqlite
can't fill in those empty descriptor slots and therefore won't open a database.
Once I debugged the problem, fixing it with mknod(8) was
straightforward, but it did require loosening the mount options on
/var, which is not great.
If you wish to work around this in ksql, not closing stdin and stdout in
the child should do it. Otherwise, perhaps a note in the documentation
would help others avoid the problem.
The text was updated successfully, but these errors were encountered: