[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2014-03-05 Thread Robert Olofsson (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13920736#comment-13920736
 ] 

Robert Olofsson commented on IO-269:


I came across this issue and noticed an inefficiency in the code of the run 
method.

With the reOpen flag set a new RandomAccessFile is always created at the end of 
the main while loop in the run method:

if (getRun()  reOpen) {
reader = new RandomAccessFile(file, RAF_MODE);
reader.seek(position);
}

This is unnecessary and contributes to unnecessary file locking on Windows.

If the reOpen flag is set a new RandomAccessFile should only be created when 
the length of the file or the last modification date indicate that the file 
needs to be read. 


 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Fix For: 2.4

 Attachments: IO-269-v2.patch, IO-269-v3.patch, IO-269.patch, 
 ReOpen.java


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2014-03-05 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13920904#comment-13920904
 ] 

Sebb commented on IO-269:
-

bq. This is unnecessary and contributes to unnecessary file locking on Windows.

On the contrary, it is an essential part of unlocking the file on Windows when 
possible.
The full code is as follows:

{code}
if (reOpen) {
IOUtils.closeQuietly(reader);
}
Thread.sleep(delayMillis);
if (getRun()  reOpen) {
reader = new RandomAccessFile(file, RAF_MODE);
reader.seek(position);
}
{code}

Notice that the file is closed - and therefore unlocked - during the sleep if 
reOpen is true.
If reOpen is false, the file remains locked by Windows for the duration of the 
Tailer thread.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Fix For: 2.4

 Attachments: IO-269-v2.patch, IO-269-v3.patch, IO-269.patch, 
 ReOpen.java


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2014-03-05 Thread Robert Olofsson (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13920933#comment-13920933
 ] 

Robert Olofsson commented on IO-269:


Yes the file is closed when while loop sleeps, however what I'm trying to point 
out is that the file is always opened during each iteration of the loop even 
when it's not necessary.

There is no need to open the file unless changes to it's length or last 
modified date are detected.

I've created a modified version of Tailer for small desktop app called 
SwingTail (http://unlogic.se/projects/swingtail) the incorporates these changes 
among others. However I've done so many other changes that I couldn't generate 
a clean diff. But the source is available here:

svn://svn.unlogic.se/swingtail/trunk/src/se/unlogic/swingtail/Tailer.java

Essentially I simply removed the open statement from the end of the loop and 
added three separate open statements higher up the loop that only open the file 
when a change is actually detected.


 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Fix For: 2.4

 Attachments: IO-269-v2.patch, IO-269-v3.patch, IO-269.patch, 
 ReOpen.java


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2014-03-05 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13920973#comment-13920973
 ] 

Sebb commented on IO-269:
-

I see now.

In that case, I think a new JIRA issue is required.
The original issue was fixed so is complete.
Your proposal is to improve the locking behaviour, so should be filed as an 
enhancement please.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Fix For: 2.4

 Attachments: IO-269-v2.patch, IO-269-v3.patch, IO-269.patch, 
 ReOpen.java


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-06-08 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13291632#comment-13291632
 ] 

Sebb commented on IO-269:
-

bq. Marcos indicated that it was not the case in his benchmark.

The readLines() method won't return until it reaches EOF, so when run against a 
pre-existing file there won't be any re-opens. It has to be run against a file 
that is growing.

bq. Do you have any benchmark to back up the less efficient statement? 

Yes, it can be up to about 45% slower. 
I used the attached benchmark (to follow), which simulates EOF by reading lines 
in chunks.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269-v2.patch, IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-06-07 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13291432#comment-13291432
 ] 

Sebb commented on IO-269:
-

File locking is only a problem on Windows, and could perhaps be addressed in a 
later release of the JVM.
Also, for some applications, it may not be necessary to allow concurrent 
rename/deletion.
So I think the re-open strategy should be an optional feature.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269-v2.patch, IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-06-07 Thread Niall Pemberton (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13291452#comment-13291452
 ] 

Niall Pemberton commented on IO-269:


With NIO2 in JDK 7 I wouldn't hold out much hope for future file improvements.

Also optional platform specific features really go against the ethos of Java's 
write once, run anywhere.

Any reason why reopening is a bad idea on other non-Windoze platforms?

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269-v2.patch, IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-06-07 Thread Sebb (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13291469#comment-13291469
 ] 

Sebb commented on IO-269:
-

bq. Also optional platform specific features really go against the ethos of 
Java's write once, run anywhere.

I was not proposing making the code OS-specific.

bq. Any reason why reopening is a bad idea on other non-Windoze platforms?

It would be somewhat less efficient.
Also, AFAIK the Tailer can continue following a renamed file.

If there do turn out to be issues with the new strategy - could it cause file 
rotations to be missed? - making it optional is safer.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269-v2.patch, IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-06-07 Thread Niall Pemberton (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13291490#comment-13291490
 ] 

Niall Pemberton commented on IO-269:


Do you have any benchmark to back up the less efficient statement? Marcos 
indicated that it was not the case in his benchmark.

Continuing to tail a file thats been renamed would be a bug (log files is a 
good example of that).

The current implementation can miss rotations - thats a factor of the delay and 
how fast/frequently the file is being written to. So the question really is, is 
it more likely to miss rotations and I believe that goes back to the efficiency 
question.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269-v2.patch, IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-03-17 Thread Sebb (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13232137#comment-13232137
 ] 

Sebb commented on IO-269:
-

Thanks for the patch.

In the benchmark, how big was the file that you were tailing?

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2012-03-17 Thread Commented

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13232143#comment-13232143
 ] 

Marcos Vinícius da Silva commented on IO-269:
-

The file was 9,73Mb.
The tailer was running with zero delay.

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb
 Attachments: IO-269.patch


 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (IO-269) Tailer locks file from deletion/rename on Windows

2011-04-11 Thread Niall Pemberton (JIRA)

[ 
https://issues.apache.org/jira/browse/IO-269?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13018287#comment-13018287
 ] 

Niall Pemberton commented on IO-269:


This was reported by Hemal Pandya in the following thread:

http://markmail.org/message/3qydndh4doszjmdz

 Tailer locks file from deletion/rename on Windows
 -

 Key: IO-269
 URL: https://issues.apache.org/jira/browse/IO-269
 Project: Commons IO
  Issue Type: Bug
Reporter: Sebb

 The Tailer code works on Windows, except that it locks the file against 
 deletion or rename.
 The test code fails to detect this, because it fails to check if the file 
 deletion succeeds.
 This seems to be a Windows OS issue.
 A possible solution might be to keep closing and re-opening the file.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira