You are viewing a plain text version of this content. The canonical link for it is here.
Posted to distributedlog-dev@bookkeeper.apache.org by khurrumnasimm <gi...@git.apache.org> on 2016/10/21 16:04:22 UTC

[GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...

GitHub user khurrumnasimm opened a pull request:

    https://github.com/apache/incubator-distributedlog/pull/42

    Fix deadlock on BKSyncLogReaderDLSN

    Change the lastSeenDLSN to volatile to remove the synchronization block to avoid deadlock with sharedLock

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/khurrumnasimm/incubator-distributedlog kn/fix_deadlock

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-distributedlog/pull/42.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #42
    
----
commit 3ff9e8a77320ef3ba284d171d9c7693d90089f0d
Author: Khurrum Nasim <kh...@gmail.com>
Date:   2016-10-21T16:02:05Z

    Fix deadlock on BKSyncLogReaderDLSN
    
    Change the lastSeenDLSN to volatile to remove the synchronization block to avoid deadlock with sharedLock

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...

Posted by sijie <gi...@git.apache.org>.
Github user sijie commented on a diff in the pull request:

    https://github.com/apache/incubator-distributedlog/pull/42#discussion_r87980394
  
    --- Diff: distributedlog-core/src/main/java/com/twitter/distributedlog/BKSyncLogReaderDLSN.java ---
    @@ -116,7 +110,7 @@ public void resumeReadAhead() {
     
         @Override
         public void onSuccess(LogRecordWithDLSN record) {
    -        setLastSeenDLSN(record.getDlsn());
    +        this.lastSeenDLSN = record.getDlsn();
    --- End diff --
    
    LGTM. @leighst what do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-distributedlog/pull/42


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...

Posted by khurrumnasimm <gi...@git.apache.org>.
Github user khurrumnasimm commented on a diff in the pull request:

    https://github.com/apache/incubator-distributedlog/pull/42#discussion_r86109926
  
    --- Diff: distributedlog-core/src/main/java/com/twitter/distributedlog/BKSyncLogReaderDLSN.java ---
    @@ -116,7 +110,7 @@ public void resumeReadAhead() {
     
         @Override
         public void onSuccess(LogRecordWithDLSN record) {
    -        setLastSeenDLSN(record.getDlsn());
    +        this.lastSeenDLSN = record.getDlsn();
    --- End diff --
    
    Are you referring this code below? lastDLSNSeenByReadAhead is a local variable and the lastSeenDLSN is a volatile variable. The visibility and the ordering of a volatile variable is guaranteed by java - that says accessing the lastSeenDLSN will retrieve the latest value, hence no atomicity is required here.
    
    `                        // if last seen DLSN by reader is same as the one seen by ReadAhead
                            // that means that reader is caught up with ReadAhead and ReadAhead
                            // is caught up with stream
                            shallWait = DLSN.InitialDLSN != lastDLSNSeenByReadAhead
                                    && lastSeenDLSN.compareTo(lastDLSNSeenByReadAhead) < 0
                                    && startDLSN.compareTo(lastDLSNSeenByReadAhead) <= 0;`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...

Posted by leighst <gi...@git.apache.org>.
Github user leighst commented on a diff in the pull request:

    https://github.com/apache/incubator-distributedlog/pull/42#discussion_r90049911
  
    --- Diff: distributedlog-core/src/main/java/com/twitter/distributedlog/BKSyncLogReaderDLSN.java ---
    @@ -116,7 +110,7 @@ public void resumeReadAhead() {
     
         @Override
         public void onSuccess(LogRecordWithDLSN record) {
    -        setLastSeenDLSN(record.getDlsn());
    +        this.lastSeenDLSN = record.getDlsn();
    --- End diff --
    
    shipit


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-distributedlog pull request #42: Fix deadlock on BKSyncLogReaderDL...

Posted by khurrumnasimm <gi...@git.apache.org>.
Github user khurrumnasimm commented on a diff in the pull request:

    https://github.com/apache/incubator-distributedlog/pull/42#discussion_r87690568
  
    --- Diff: distributedlog-core/src/main/java/com/twitter/distributedlog/BKSyncLogReaderDLSN.java ---
    @@ -116,7 +110,7 @@ public void resumeReadAhead() {
     
         @Override
         public void onSuccess(LogRecordWithDLSN record) {
    -        setLastSeenDLSN(record.getDlsn());
    +        this.lastSeenDLSN = record.getDlsn();
    --- End diff --
    
    @leighst I pushed another change to remove 'synchronized' block. please review it again. thank you in advance.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---