Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge all other contributions #32

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

manusfreedom
Copy link

New features
Fix Windows bugs

@sincedb_write_pending = false
@sincedb_writing = false

System.gc()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this GC call?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also,I did not add this below so I assume you are talking to the group

Sent from my iPad

On Aug 1, 2014, at 2:11 AM, Jordan Sissel notifications@github.com wrote:

In lib/filewatch/tail.rb:

@@ -242,6 +291,12 @@ def _sincedb_write
rescue => e
@logger.warn("_sincedb_write rename/sync failed: #{tmp} -> #{path}: #{e}")
end
+

  •  @sincedb_last_write = now
    
  •  @sincedb_write_pending = false
    
  •  @sincedb_writing = false
    
  •  System.gc()
    
    Why do this GC call?


Reply to this email directly or view it on GitHub.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it to be sure we regulary clean the memory.
I use this gem on logstash and we can have memory problem during mass write in logs.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding some context here, I tried this updated tail.rb code in Logstash and it fails with the following error:

image

In order for it to run in Logstash, I have to add the following 2 lines to the beginning of the file so it knows what System is.

require "java"
java_import "java.lang.System"

Certainly, curious if the GC call is required since the existing Logstash filewatch tail.rb doesn't have it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never found it necessary to invoke GC manually in Logstash, so without knowing more details, I'll remove this before merging.

@jordansissel
Copy link
Owner

I haven't fully reviewed the code, but I am nervous about the lack of any tests for the fixes as proposed.

I recognize that there aren't much in the way of tests in the current codebase, but this code is pretty old and I am a bit more aware of my need to test these days. Thoughts on adding tests?

@bdanziger
Copy link

I am not sure if this question is directed to me or others. I found some issues with _sincedb code and restarting which were a big problem or me. It was clear that the code wasn't flusuhing the file properly. I was going to setup my test cases to run as was expected but I realized I might not have the latest code and I became confused. I found different version in ruby gems that was a little I fferent then what was in the git. So, I emailed out a bunch of questions about this and never heard back from anyone. So, I didn't know the right thing to do, made myself my own version and moved on. My version with the changes i proposed has been running without a single problem since march or April on a daily basis and I am running about 5 or 6 instances of this. I had my own test case but it was manual.

Sent from my iPad

On Aug 1, 2014, at 2:13 AM, Jordan Sissel notifications@github.com wrote:

I haven't fully reviewed the code, but I am nervous about the lack of any tests for the fixes as proposed.

I recognize that there aren't much in the way of tests, but this code is pretty old and I am a bit more aware of my need to test these days. Thoughts on adding tests?


Reply to this email directly or view it on GitHub.

@bdanziger
Copy link

I hit send too soon,,,,

Github , it looks like it is at 0.5.0
Ruby gems shows 0.5.1

I am not sure how ruby gems could be ahead of the github so I had no idea if I had the latest version of the code.

If you can clue me in on how I make sure I have the latest one, I can go back to this ....make sure the changes are where they should be and don't conflict with any other releases and I can add in a test case.

But, I would need a little direction. Maybe it is me but the different versions make no sense to me,

Thanks

Sent from my iPad

On Aug 1, 2014, at 2:13 AM, Jordan Sissel notifications@github.com wrote:

I haven't fully reviewed the code, but I am nervous about the lack of any tests for the fixes as proposed.

I recognize that there aren't much in the way of tests, but this code is pretty old and I am a bit more aware of my need to test these days. Thoughts on adding tests?


Reply to this email directly or view it on GitHub.

@manusfreedom
Copy link
Author

@jordansissel, I don't know how can I add tests, I can only give my experience using my version.
We use this version with my patched logstash (https://github.com/manusfreedom/logstash).
It's deployed on 120 servers (40 productions), who generate 1 to 2 millions of logs per day each.
And ruby-filewatch manages from 10 to 75 log files per server.
All servers are under Windows Server 2008 R2 or 2012 R2.

Here, a screenshot of Kibana for 9 productions servers: http://demo.ovh.eu/View/44e45f23270933c2384f332f9d96ee76/0
111 millions of logstash events during last week (and some are multilines logs).

# since there is no update, we should pass control back in case the caller needs to do any work
# otherwise, they can ONLY do other work when a file is created or modified
@logger.debug("#{path}: nothing to update")
yield(:noupdate, path)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a no-op event doesn't feel like it fits well. filewatch isn't intended to be a ticking event system, seems like sincedb syncing should be done in a separate thread instead of using this method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not agree, because if both thread are not perfectly sync, you can lost or duplicate some data after a stop/start.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are any questions with my update, I can answer then very specifically when I get back to the hotel tonight.

Unfortunately, I was not certain that the git had the latest code because I found differences with the same gem code.  I questioned this months ago but never heard back.   I will help in any way you would like .  Just let me know

Sent from Yahoo Mail on Android

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow that.   Which threads see not on sync...tail and watch?  All this is doing is letting one give up control so it doesn't lock out the caller....otherwise sincedb can become stale.   I have tested this for months without an issue...where prior start and stop constantly were having issues because sincedb was not flushed out.   I don't have the code in front of me because I am away on vacation but in the the release, I also fixed a start stop timing issue that is documented in the update . Maybe this is what you are referring to...but hard to tell from the statement

Sent from Yahoo Mail on Android

@jordansissel
Copy link
Owner

I am in favor of improved windows support, and have mostly completed my review of this patch.

My main concern is the backwards incompatibility in the sincedb file format. We cannot change this format. I suspect the change was to support files with spaces in them? If so, we can work around that without changing the file format.

The GC call should also be removed especially because it is not valid under MRI or Rubinius.

If there is no response on this within a day or so, I will fix the code prior to merging because there are a number of users concerned with windows support problems.

@manusfreedom
Copy link
Author

@jordansissel I perfectly understand your concern about backwards incompatibility, maybe you change the space by another char only on windows?
For GC, I will keep it on my version, I understand the problem about MRI or Rubinius.

# updated files overwrite original ones, resulting in inode changes. In order to
# avoid having the sincedb.member check from failing in this scenario, we'll
# construct the inode key using the path which will be 'stable'
inode = [path, stat.dev_major, stat.dev_minor]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated my PR with this change to better handle some uncommon (but legal) path characters in linux:

michio-nikaido@0e3e6c2

I don't see it here, so I wanted to point that out because an embedded space would otherwise throw off the line parsing for sincedb

Conflicts:
	lib/filewatch/tail.rb
	lib/filewatch/watch.rb
Fix @sincedb[sincedb_record_uid] null when addin a file
Fix missing end keyword
Fix typo
@manusfreedom
Copy link
Author

My last commits are in test with logstash 1.5.0 on 50 servers and will be with 120 servers next monday.

@manusfreedom
Copy link
Author

Works well on 120 servers and million lines.
Can be merged and/or tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants