[OpenSIPS-Devel] [OpenSIPS/opensips] d3b146: db_flatstore: Fix missing CDRs due to 'flat_rotate...

Liviu Chircu noreply at github.com
Fri Nov 4 18:05:24 UTC 2022


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: d3b1463ee115a8b7d4d6b9658c8b07b9ef3d0549
      https://github.com/OpenSIPS/opensips/commit/d3b1463ee115a8b7d4d6b9658c8b07b9ef3d0549
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2022-11-04 (Fri, 04 Nov 2022)

  Changed paths:
    M modules/db_flatstore/flat_mi.c
    M modules/db_flatstore/flat_mi.h
    M modules/db_flatstore/flatstore.c
    M modules/db_flatstore/flatstore_mod.c

  Log Message:
  -----------
  db_flatstore: Fix missing CDRs due to 'flat_rotate' race conditions

This commit simply adds R/W locking around the 'flat_rotate' MI command,
and all the SIP worker processes.  The race condition was as follows:

* SIP worker checks the 'flat_rotate' stamp and proceeds to write CDR
* 'flat_rotate' is ran (timestamp++)
* external process scans & fully reads the rotated file (with deletion
   to follow later as well, but this is irrelevant)
* SIP worker finally writes the CDR using flushed/vector'ed I/O
   (too late at this point, CDR is forever lost)





More information about the Devel mailing list