https://gitlab.synchro.net/main/sbbs/-/commit/c42d0dc07c40a611a54f9b33
Modified Files:
src/sbbs3/main.cpp
Log Message:
Close an sbbs_t's log file after its last log line, not before
The destructor closed logfile_fp, then logged "destructor end" (under
_DEBUG). For an event thread instance, lputs() lazily reopens
data/events.log into logfile_fp, so that final line reopened the file
and the object was destroyed with it open: one stdio stream leaked per destruction.
Since e2cc0e5bba (2026-10-25) the event thread runs each QWK sweep job
in its own sbbs_t, so the leak recurred with every REP import or QWK
pack. On vert about 500 jobs exhausted the C runtime's 512 stdio
streams in 12 hours, after which every fopen()/fdopen() in the process
failed with EMFILE: POP3 could not open mail.shd, the Terminal Server
could not open node.log or nonodes.txt, FTP logins failed, and the
event thread logged "Too many open files" reading system stats every
10 seconds. Real users' logins were then misreported as unknown users
and penalized (#1307).
The lazy reopen in lputs() dates from 39ad6926a1 (2025-03-01) and the post-close log line from 9e0fcab856 (2018-07-25); the long-lived event
thread instance leaked only once, at shutdown.
Co-Authored-By: Claude Fable 5.1 <
noreply@anthropic.com>
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)