Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Gavin Andresen on November 18, 2010, 12:24:45 AM



Title: svn rev 181, 182 and 183
Post by: Gavin Andresen on November 18, 2010, 12:24:45 AM
It'd been a while since I shot myself in my foot, so I guess I was overdue.

Anyhow, on my third attempt I think I've got it right-- I fixed a bug that was causing Bitcoin to be unusably slow on Macs running FileVault (the built-in filesystem encryption on the Mac).

The problem was Bitcoin opening and then closing the debug.log file on every write.  After a couple of "too clever for my own good" solutions that broke, or could break, in interesting ways, the code now opens debug.log and simply keeps it open, constantly appending to it.

If you run a bitcoind server, see the "don't forget to rotate your logs (http://bitcointalk.org/index.php?topic=292.0)" thread for what you need to do for log rotation to work properly.


Title: Re: svn rev 181, 182 and 183
Post by: wumpus on November 18, 2010, 08:11:46 AM
The problem was Bitcoin opening and then closing the debug.log file on every write.  After a couple of "too clever for my own good" solutions that broke, or could break, in interesting ways, the code now opens debug.log and simply keeps it open, constantly appending to it.
Indeed, fflush is good enough to make sure the data gets written, constantly reopening/closing the file won't do anything beyond that.