PiRSquared17 / snaketail-net

Automatically exported from code.google.com/p/snaketail-net
1 stars 0 forks source link

Latest file detection works oddly on Network shares #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Add a logfile directory to monitor on a network share... such as:
\\server\c$\Logs\MyLogPrefix*
2. If there are mutliple matching ones, for example, if the Logfile appends 
numbers... so the log files looks like MyLogPrefix1.log and MylogPrefix2.log 
(when 1 is full)

What is the expected output? What do you see instead?
I should see snaketail automatically grab the latest one such as 
MylogPrefix2.log.  Instead, it stays on MyLogPrefix1.log.

What I have found is that when this happen and I go to the file directory in 
Windows 7, MyLogPrefix2.log shows up, but has 0 file length. But it really has 
stuff in it. If I then go edit the file, Windows explorer refreshes with the 
right value... and then SnakeTail picks up the change.

I'm not sure if there is a way for snaketail to invoke some kind of manual 
refresh on the windows directory share or something.  Looks like an issue with 
windows network share directory caching.

What version of the product are you using? On what operating system?
1.8.2 on windows 7

Please provide any additional information below.

Original issue reported on code.google.com by yam...@gmail.com on 1 May 2013 at 7:55

GoogleCodeExporter commented 9 years ago
Sounds like I'm hit by this error, when using DirectoryInfo.GetFiles:

http://stackoverflow.com/questions/12825605/directory-getfiles-not-returning-the
-correct-number-of-files

Maybe have to consider to use the FileSystemWatcher class, though it also seem 
to have bugs:

http://www.codeproject.com/Articles/15656/Advanced-FileSystemWatcher

Original comment by sweaty1 on 2 May 2013 at 7:14

GoogleCodeExporter commented 9 years ago
Could you try if the attached file SnakeTail.v1.8.2.1.zip solves the problem.

I have added a forced Refresh of the DirectoryInfo object used to list files on 
the network share.

I have tried to use SnakeTail to monitor a network share without the forced 
Refresh, and it had no issue with detecting a new file had arrived (Created the 
file using Remote Desktop and had no open Windows Explorer windows)

Original comment by sweaty1 on 2 May 2013 at 7:33

Attachments:

GoogleCodeExporter commented 9 years ago
Awesome response. I'll try it asap.

Original comment by yam...@gmail.com on 2 May 2013 at 7:58

GoogleCodeExporter commented 9 years ago
Doesn't seem to work right.
Seems to get stuck on 'Loading File'
File size is about 52 MB. So nothing extra big.

Original comment by yam...@gmail.com on 6 May 2013 at 6:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Never mind, it just appeared to get stuck. Seems to work :)
Just took some time to get past the 'loading file'

Original comment by yam...@gmail.com on 6 May 2013 at 6:19

GoogleCodeExporter commented 9 years ago
Maybe we should try to use a dedicated thread for monitoring for new files, so 
it doesn't block the entire application.

Original comment by sweaty1 on 6 May 2013 at 6:27

GoogleCodeExporter commented 9 years ago
Could you try if the attached file SnakeTail.v1.8.2.2.zip works without 
blocking ?

The delay will probably still be there, as it still has to wait for the network 
share to be refreshed.

Original comment by sweaty1 on 6 May 2013 at 8:09

Attachments:

GoogleCodeExporter commented 9 years ago
Could you try if the attached file SnakeTail.v1.8.2.3.zip works without 
blocking ?

Improved exception handling, when using threads.

Original comment by sweaty1 on 8 May 2013 at 8:54

Attachments:

GoogleCodeExporter commented 9 years ago
yes SnakeTail.v1.8.2.3.zip  worked much better.

It still 'blocks' a little bit when I first opened the session. Perhaps 
unresponsive for like 3 seconds. But aside from the load session bit, there 
isn't any noticeable blocking.

Looks like a very good change to me!

Original comment by yam...@gmail.com on 8 May 2013 at 9:37

GoogleCodeExporter commented 9 years ago
Yes 1.8.2.2 had a "late night blunder" where it performed both synchronous and 
asynchronous refresh of the directory. Now it only performs asynchronous 
refresh.

Also got myself a ThreadPoolQueue, which I can use for executing external tools 
asynchronously, when there is line that matches a keyword. But that is for 
another issue.

Original comment by sweaty1 on 8 May 2013 at 9:53

GoogleCodeExporter commented 9 years ago
Ver. 1.9.0 has been released

Original comment by snakenes...@gmail.com on 30 Sep 2014 at 10:22