3.0.2: rlm_sql_null duplicating its statements

Alan DeKok aland at deployingradius.com
Thu Apr 10 20:17:30 CEST 2014


Stefan Winter wrote:
> Take the patch or leave it, it does seem to work for us :-)

  Please try the v3.0.x branch from git.  I've added a new logging API.
 Then, made sql use it, and detail, and linelog.

  It automatically makes sub-directories, as only "detail" did that
previously.

  It caches the file descriptor, and re-uses it among threads.  The
descriptor is closed when it hasn't been used for 30s.

  Writes to the file are protected by the POSIX locking API.  All
threads share one file descriptor, which is closed only when it hasn't
been used for 30s.

  Since the FDs are now rarely closed, any POSIX locking issues should
mostly be avoided.

  We can't help it if *another* module opens && closes the same file.
But that's a configuration error.  Module A and module B shouldn't be
writing to the same file.

  Thread access to the file descriptor is protected by a mutex.  So only
one thread at a time will be using the file descriptor.

  The hope is that this change avoids all of the POSIX locking issues
you've seen.  It also re-uses FDs, which should be faster than
re-opening the file every time.

  Let me know if there are any issues.  It passes my tests, but I didn't
try hammering it under load.

  Alan DeKok.


More information about the Freeradius-Users mailing list