Skip to content

Commit 61173fa

Browse files
author
Guy Boertje
committed
Rescue ENOENT when discoverer stats a discovered file and its missing
This is hard to create a meaningful test for this. The async `rm` call will have to occur at exactly the right point between a file being discovered and it being deleted. Fixes logstash-plugins#204
1 parent 06ad65c commit 61173fa

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.1.6
2+
- Fixed Errno::ENOENT exception in Discoverer. [Issue #204](https://github.com/logstash-plugins/logstash-input-file/issues/204)
3+
14
## 4.1.5
25
- Fixed text anchor by changing it from hardcoded to asciidoc reference to
36
work in versioned plugin reference

Diff for: lib/filewatch/discoverer.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,13 @@ def discover_any_files(path, ongoing)
6363
new_discovery = false
6464
watched_file = @watched_files_collection.watched_file_by_path(file)
6565
if watched_file.nil?
66+
begin
67+
path_stat = PathStatClass.new(pathname)
68+
rescue Errno::ENOENT
69+
next
70+
end
71+
watched_file = WatchedFile.new(pathname, path_stat, @settings)
6672
new_discovery = true
67-
watched_file = WatchedFile.new(pathname, PathStatClass.new(pathname), @settings)
6873
end
6974
# if it already unwatched or its excluded then we can skip
7075
next if watched_file.unwatched? || can_exclude?(watched_file, new_discovery)

Diff for: logstash-input-file.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-input-file'
4-
s.version = '4.1.5'
4+
s.version = '4.1.6'
55
s.licenses = ['Apache-2.0']
66
s.summary = "Streams events from files"
77
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"

0 commit comments

Comments
 (0)