Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make sure Errno::ENOENT is raised when File.stat() fails #16

Merged
merged 1 commit into from

2 participants

@eric

EventMachine::FileTail#handle_eof() is expecting an ENOENT when a stat
fails, but instead is getting back a nil stat struct.

It causes an unhappy exception:

/Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:395:in `handle_fstat': undefined method `ino' for nil:NilClass (NoMethodError)
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:333:in `block in handle_eof'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:370:in `read_file_metadata'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:332:in `handle_eof'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-tail-0.6.3/lib/em/filetail.rb:302:in `block in schedule_eof'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `call'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `block in run_deferred_callbacks'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `each'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-0.12.10/lib/eventmachine.rb:996:in `run_deferred_callbacks'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
    from /Users/eric/src/remote_syslog/vendor/bundle/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
    from /Users/eric/src/remote_syslog/lib/remote_syslog/cli.rb:164:in `start'
    from /Users/eric/src/remote_syslog/lib/remote_syslog/cli.rb:155:in `run'
    from /Users/eric/src/remote_syslog/lib/remote_syslog/cli.rb:17:in `process!'
    from /Users/eric/src/remote_syslog/bin/remote_syslog:6:in `<top (required)>'
    from /Users/eric/src/remote_syslog/vendor/bundle/bin/remote_syslog:19:in `load'
    from /Users/eric/src/remote_syslog/vendor/bundle/bin/remote_syslog:19:in `<main>'
@eric eric Make sure Errno::ENOENT is raised when File.stat() fails
EventMachine::FileTail#handle_eof() is expecting an ENOENT when a stat
fails, but instead is getting back a nil stat struct.
dd3b47f
@jordansissel jordansissel merged commit 84e5a30 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2012
  1. @eric

    Make sure Errno::ENOENT is raised when File.stat() fails

    eric authored
    EventMachine::FileTail#handle_eof() is expecting an ENOENT when a stat
    fails, but instead is getting back a nil stat struct.
This page is out of date. Refresh to see the latest.
View
0  bin/emtail 100644 → 100755
File mode changed
View
0  bin/rtail 100644 → 100755
File mode changed
View
2  lib/em/filetail.rb
@@ -354,6 +354,8 @@ def handle_eof
def read_file_metadata(&block)
begin
filestat = File.stat(@path)
+ rescue Errno::ENOENT
+ raise
rescue => e
@logger.debug("File stat on '#{@path}' failed")
on_exception e
Something went wrong with that request. Please try again.