Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11016: Boost file logging misbehaves when file system is full
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-23 21:26:54
#11016: Boost file logging misbehaves when file system is full
-------------------------------+----------------------
Reporter: michi@⦠| Owner: andysem
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: log
Version: Boost 1.55.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------
Changes (by Michi Henning <michi.henning@â¦>):
* status: closed => reopened
* resolution: fixed =>
Comment:
Replying to [comment:22 andysem]:
> Yes, that is how it should work. The empty file appears because the file
is rotated at application exit, and the new run starts a new file. You can
add std::ios::app to the file open flags in the sink backend if you want
to append to the previous file on every next run.
I just tried this, by adding keywords::open_mode = std::ios::app when I
create the sink. But it doesn't appear to change anything. The last log
file from the previous run isn't appended to; instead, a new log file is
created regardless. Other people seem to have had the same experience:
http://stackoverflow.com/questions/8418917/boost-log-how-to-configure-a
-text-sink-backend-to-append-to-rotated-files
Am I doing something wrong?
> Unless you enable appending, you get a new file regardless of the file
emptiness or space exhaustion. This behavior seems logical to me. Empty
files can also be an indication of a certain behavior of the app, so they
are not completely worthless.
I honestly can't think of a reason why an empty file would be useful.
I experimented with this some more. So, I run the test case until the file
system is full, at which point it leaves an empty log file behind. Now I
run the test three more times, so I end up with four empty log files (plus
a whole bunch of non-empty ones). Then I delete some non-empty log files
so there is plenty of room again, and run the test one more time. As
expected, it now creates two new non-empty log files. But the file
rotation code never removes the empty log files, even after there is space
in the file system.
I'm sorry, but this is still not right. Once the file system fills up,
boost log creates an empty log file on every file rotation. These empty
files accumulate indefinitely and are never removed. That's a permanent
resource leak.
The code should check on the first write after creating a log file whether
the write succeeded. Otherwise, something is seriously wrong, and it
should unlink the file it just created.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11016#comment:25> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC