Project

General

Profile

Actions

Bug #7917

closed

Can't write to a Logger in a signal handler

Added by mperham (Mike Perham) about 11 years ago. Updated over 6 years ago.

Status:
Rejected
Target version:
ruby -v:
2.0.0-rc2
[ruby-core:52722]

Description

Looks like Ruby 2.0 does not allow Mutex#lock within a signal handler. This prevents Logger from working since it uses an underlying mutex.

log writing failed. can't be called from trap context
log writing failed. can't be called from trap context
log writing failed. can't be called from trap context
log writing failed. can't be called from trap context

Here's Ruby code which reproduces the problem:

require 'logger'

LOG = Logger.new(STDOUT)
LOG.info "Now logging!"

trap 'INT' do
LOG.info "Hello"
end

sleep
LOG.info "Done"

Run it and hit Ctrl-C.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0