This project is archived and is in readonly mode.

#6671 new
Brian Durand

BufferedLogger threading issues

Reported by Brian Durand | April 5th, 2011 @ 03:06 AM

There are a couple of threading issues with ActiveSupport::BufferedLogger.

  1. If a thread is spawned and logs messages but does not flush the log, the messages will never be written and will remain in the buffer forever.

threads = []
urls.each do |url
threads << Thread.new do

logger.info("fetching #{url}")
fetch(url)
logger.info("#{url} retrieved")

end end
threads.each{|t| t.join}

  1. Silencing a logger for a block in one thread will silence it will silence it for all other threads as well. This means in a multi-threaded Rails application, log messages can be lost.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Tags

Pages