You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Dariusz Szablinski (JIRA)" <ji...@apache.org> on 2011/04/06 17:05:05 UTC

[jira] [Commented] (AMQ-3273) Slave broker acquires lock file when Master is still alive (shared file system master/slave setup)

    [ https://issues.apache.org/jira/browse/AMQ-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016400#comment-13016400 ] 

Dariusz Szablinski commented on AMQ-3273:
-----------------------------------------

Index: kahadb/src/main/java/org/apache/kahadb/util/LockFile.java
===================================================================
--- kahadb/src/main/java/org/apache/kahadb/util/LockFile.java	(revision 1089459)
+++ kahadb/src/main/java/org/apache/kahadb/util/LockFile.java	(working copy)
@@ -63,7 +63,7 @@
             readFile = new RandomAccessFile(file, "rw");
             IOException reason = null;
             try {
-                lock = readFile.getChannel().tryLock(0, readFile.getChannel().size(), false);
+                lock = readFile.getChannel().tryLock(0, Math.max(1, readFile.getChannel().size()), false);
             } catch (OverlappingFileLockException e) {
                 reason = IOExceptionSupport.create("File '" + file + "' could not be locked.",e);
             } catch (IOException ioe) {


> Slave broker acquires lock file when Master is still alive (shared file system master/slave setup)
> --------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3273
>                 URL: https://issues.apache.org/jira/browse/AMQ-3273
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.5.0
>         Environment: Windows 7, Windows Server 2008 
>            Reporter: Dariusz Szablinski
>            Priority: Critical
>             Fix For: 5.5.0, 5.6.0
>
>         Attachments: LockFile.java.patch
>
>
> The change introduced in AMQ-3237 has triggered issue with LockFile.lock() on Win7 and Win2k8. See comments to the JRE issue http://bugs.sun.com/view_bug.do?bug_id=6628575 (bottom of the page).  
> Suggested solution is to use this construction instead:
> fc.lock( 0, Math.max( 1, fc.size() ), false );

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