Details

Description

Currently we are facing some issues with the log4net configuration in our project. I am looking for help on this.

We are getting the following error in the log4net log file:

Error: Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.]

We are using the rollinglogfileAppender with the rolling style as "Date" and the locking model as "log4net.Appender.FileAppender+MinimalLock".

When nearly 250 users in our application tries to write to the log file it is coming with the above error message.

Ron Grabowski
added a comment - 21/May/08 22:55 The mailing lists are much better places to ask for general help about log4net.
What is your Date pattern for the rolling?
MinimalLock is very slow. Why aren't you using the default ExclusiveLock?

This doesn't look like log4net bug so I'm recommending again that you take this discussion to one of the mailing lists. More people monitor the lists so you might get a faster response from there.

The MinimalLock is very slow compared to the default ExclusiveLock. Its not designed for what you're using it for. Do you have multiple instances of your program trying to write to the same file? With 250 users it sounds like the AdoNetAppender would be a better choice. log4net isn't a database server. Have you tried using the MutexLock that was posted to the log4net-users list a few months ago? That allows multiple processes to write to the same file while still being performant.

I'd recommend against using the RollingFileAppender and the MinimalLock in all but the most basic scenarios (i.e. for single user / single threaded apps its fine).

Ron Grabowski
added a comment - 22/May/08 17:09 This doesn't look like log4net bug so I'm recommending again that you take this discussion to one of the mailing lists. More people monitor the lists so you might get a faster response from there.
The MinimalLock is very slow compared to the default ExclusiveLock. Its not designed for what you're using it for. Do you have multiple instances of your program trying to write to the same file? With 250 users it sounds like the AdoNetAppender would be a better choice. log4net isn't a database server. Have you tried using the MutexLock that was posted to the log4net-users list a few months ago? That allows multiple processes to write to the same file while still being performant.
I'd recommend against using the RollingFileAppender and the MinimalLock in all but the most basic scenarios (i.e. for single user / single threaded apps its fine).
I'm eventually going to mark this ticket as Invalid.

Ron Grabowski
added a comment - 22/May/08 21:53 Use your browser to navigate to this page:
http://www.google.com/
type the following text into the search box that appears:
log4net mailing lists
then press the button that says:
I'm Feeling Lucky
You can also visit the log4net home page to find out how to subscribe to the lists.

The RollingFileAppender/MinimalLock combination most likely won't work with 250+ users....RollingFileAppender/MinimalLock isn't a database! If you must use a RollingFileAppender use a MutextLock instead.

Ron Grabowski
added a comment - 14/Jun/08 15:18 The RollingFileAppender/MinimalLock combination most likely won't work with 250+ users....RollingFileAppender/MinimalLock isn't a database! If you must use a RollingFileAppender use a MutextLock instead.