[2026-08-31 15:56] Edin Tarić <[email protected]>
> I am running OpenSMTPD 7.8.0-portable in an Alpine Linux lxc container
> (via incus) and use table-sqlite as a backend for virtual, domain and
> auth.
>
> I noticed that nearly every time I restart the container, smtpd fails
> to start up again cleanly with the following errors in the log:
>
> mail.info smtpd[752]: info: OpenSMTPD 7.8.0-portable starting
> mail.crit smtpd[762]: lookup: table-proc: getline: Connection reset by
> peer
> mail.err smtpd[752]: warn: parent -> lka: imsgbuf_read: Connection reset
> by peer
> mail.crit smtpd[752]: smtpd: exiting: Connection reset by peer
>
> Restarting smtpd does not fix the issue. The only workaround I found is
> running table-sqlite manually once with the below command, stopping it
> with Ctrl+C and then restarting smtpd.
>
> /usr/lib/opensmtpd/table-sqlite /etc/smtpd/sqlite.conf
Does this call produce any output on stderr?
Can you also check the output of smtpd -d when this happens?
>
> Any idea what might be causing this? It does not happen when restarting
> the smtpd OpenRC service with "rc-service smtpd restart".
What might be causing this problem is, that table-sqlite doesn't
finalize the prepared statements and close the file properly on exit.
Can you test following patch:
diff --git a/table_sqlite.c b/table_sqlite.c
index 87e2ab3..769d818 100644
--- a/table_sqlite.c
+++ b/table_sqlite.c
@@ -487,5 +487,11 @@ main(int argc, char **argv)
table_api_on_fetch(table_sqlite_fetch);
table_api_dispatch();
+ for (size_t i = 0; i < SQL_MAX; i++) {
+ if (statements[i])
+ sqlite3_finalize(statements[i]);
+ }
+ sqlite3_close(db);
+
return 0;
}
Philipp
> Any help is appreciated!
>
> Best,
> Edin
>