You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/06/06 03:39:18 UTC

[jira] [Commented] (ROCKETMQ-98) Risk of unable to release putMessage Lock forever

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

ASF subversion and git services commented on ROCKETMQ-98:
---------------------------------------------------------

Commit 031347db7314b511ea7356ac892001ac1349489e in incubator-rocketmq's branch refs/heads/master from [~Jaskey]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=031347d ]

[ROCKETMQ-98]Fix risk of unable to release putMessage Lock forever closes apache/incubator-rocketmq#61


> Risk of unable to release putMessage Lock forever
> -------------------------------------------------
>
>                 Key: ROCKETMQ-98
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-98
>             Project: Apache RocketMQ
>          Issue Type: Bug
>    Affects Versions: 4.1.0-incubating
>            Reporter: Jaskey Lam
>            Assignee: Jaskey Lam
>             Fix For: 4.1.0-incubating
>
>
> In current implemenation, there are two kind of locks dev can choose. If I choose reentrantLock, and lock it then put message, in this time I change the config through admin interface to use spin lock. When trying to unlock, rocketmq will try to unlock the spin lock though actually the reentrantlock is locked, this will cause the reentrantlock not able to release forever and trying to release the wrong spin lock but actully it is not locked!
>     /**
>      * Spin util acquired the lock.
>      */
>     private void lockForPutMessage() {
>         if (this.defaultMessageStore.getMessageStoreConfig().isUseReentrantLockWhenPutMessage()) {
>             putMessageNormalLock.lock();
>         } else {
>             boolean flag;
>             do {
>                 flag = this.putMessageSpinLock.compareAndSet(true, false);
>             }
>             while (!flag);
>         }
>     }
>     private void releasePutMessageLock() {
>         if (this.defaultMessageStore.getMessageStoreConfig().isUseReentrantLockWhenPutMessage()) {
>             putMessageNormalLock.unlock();
>         } else {
>             this.putMessageSpinLock.compareAndSet(false, true);
>         }
>     }



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)