[ 
https://issues.apache.org/jira/browse/LUCENE-6507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Muir updated LUCENE-6507:
--------------------------------
    Attachment: LUCENE-6507.patch

Thanks Simon. Attached is a combined patch (mine + simon).

Without the fix, simon's test triggers the NativeFSLockFactory bug on linux, 
tripping system assertions in sun.nio.ch.SharedFileLockTable. It passes with 
the patch.

{noformat}
   [junit4]   2> Caused by: java.lang.AssertionError
   [junit4]   2>        at 
sun.nio.ch.SharedFileLockTable.removeKeyIfEmpty(FileLockTable.java:167)
   [junit4]   2>        at 
sun.nio.ch.SharedFileLockTable.removeAll(FileLockTable.java:222)
   [junit4]   2>        at 
sun.nio.ch.FileChannelImpl.implCloseChannel(FileChannelImpl.java:118)
   [junit4]   2>        ... 23 more
   [junit4]   2> 
{noformat}

The other small fixes look good to me as well. I will test this patch on 
windows and mac but I think we are in good shape.

> Directory#makeLock is trappy (it does not aquire lock, although its name 
> implies) + NativeFSLock.close() has side effects
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-6507
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6507
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Simon Willnauer
>         Attachments: LUCENE-6507.patch, LUCENE-6507.patch, LUCENE-6507.patch, 
> LUCENE-6507.patch
>
>
> the lock API in Lucene is super trappy since the lock that we return form 
> this API must first be obtained and if we can't obtain it the lock should not 
> be closed since we might ie. close the underlying channel in the NativeLock 
> case which releases all lock for this file on some operating systems. I think 
> the makeLock method should try to obtain and only return a lock if we 
> successfully obtained it. Not sure if it's possible everywhere but we should 
> at least make the documentation clear here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to