From commits-return-3234-apmail-rocketmq-commits-archive=rocketmq.apache.org@rocketmq.apache.org Mon Mar 18 06:25:27 2019 Return-Path: X-Original-To: apmail-rocketmq-commits-archive@minotaur.apache.org Delivered-To: apmail-rocketmq-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD0F7194AF for ; Mon, 18 Mar 2019 06:25:27 +0000 (UTC) Received: (qmail 3613 invoked by uid 500); 18 Mar 2019 06:25:27 -0000 Delivered-To: apmail-rocketmq-commits-archive@rocketmq.apache.org Received: (qmail 3584 invoked by uid 500); 18 Mar 2019 06:25:26 -0000 Mailing-List: contact commits-help@rocketmq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@rocketmq.apache.org Delivered-To: mailing list commits@rocketmq.apache.org Received: (qmail 3575 invoked by uid 99); 18 Mar 2019 06:25:26 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Mar 2019 06:25:26 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 0AB1E82F23; Mon, 18 Mar 2019 06:25:26 +0000 (UTC) Date: Mon, 18 Mar 2019 06:25:25 +0000 To: "commits@rocketmq.apache.org" Subject: [rocketmq-client-cpp] branch master updated: [ISSUE #89] it will crash when starting orderly push consumer. (#108) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155289032598.18228.4998136092444501183@gitbox.apache.org> From: dinglei@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: rocketmq-client-cpp X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: da49964b2c632a10ec74a0e9a66eb17378bfa1c0 X-Git-Newrev: a42078df3d538f88e32539f537c5d5a3c17aaf4c X-Git-Rev: a42078df3d538f88e32539f537c5d5a3c17aaf4c X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. dinglei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/rocketmq-client-cpp.git The following commit(s) were added to refs/heads/master by this push: new a42078d [ISSUE #89] it will crash when starting orderly push consumer. (#108) a42078d is described below commit a42078df3d538f88e32539f537c5d5a3c17aaf4c Author: donggang123 AuthorDate: Mon Mar 18 14:25:21 2019 +0800 [ISSUE #89] it will crash when starting orderly push consumer. (#108) [ISSUE #89] it will crash when starting orderly push consumer. (#108) --- src/consumer/Rebalance.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/consumer/Rebalance.cpp b/src/consumer/Rebalance.cpp index 3460457..b4e6360 100644 --- a/src/consumer/Rebalance.cpp +++ b/src/consumer/Rebalance.cpp @@ -275,6 +275,10 @@ void Rebalance::unlockAll(bool oneway) { unique_ptr pFindBrokerResult( m_pClientFactory->findBrokerAddressInSubscribe(itb->first, MASTER_ID, true)); + if (!pFindBrokerResult) { + LOG_ERROR("unlockAll findBrokerAddressInSubscribe ret null for broker:%s", itb->first.data()); + continue; + } unique_ptr unlockBatchRequest( new UnlockBatchRequestBody()); vector mqs(*(itb->second)); @@ -307,6 +311,10 @@ void Rebalance::unlock(MQMessageQueue mq) { unique_ptr pFindBrokerResult( m_pClientFactory->findBrokerAddressInSubscribe(mq.getBrokerName(), MASTER_ID, true)); + if (!pFindBrokerResult) { + LOG_ERROR("unlock findBrokerAddressInSubscribe ret null for broker:%s", mq.getBrokerName().data()); + return; + } unique_ptr unlockBatchRequest( new UnlockBatchRequestBody()); vector mqs; @@ -352,9 +360,14 @@ void Rebalance::lockAll() { LOG_INFO("LockAll " SIZET_FMT " broker mqs", brokerMqs.size()); for (map*>::iterator itb = brokerMqs.begin(); itb != brokerMqs.end(); ++itb) { + string brokerName = (*(itb->second))[0].getBrokerName(); unique_ptr pFindBrokerResult( m_pClientFactory->findBrokerAddressInSubscribe( - (*(itb->second))[0].getBrokerName(), MASTER_ID, true)); + brokerName, MASTER_ID, true)); + if (!pFindBrokerResult) { + LOG_ERROR("lockAll findBrokerAddressInSubscribe ret null for broker:%s", brokerName.data()); + continue; + } unique_ptr lockBatchRequest( new LockBatchRequestBody()); lockBatchRequest->setClientId(m_pConsumer->getMQClientId()); @@ -391,6 +404,10 @@ bool Rebalance::lock(MQMessageQueue mq) { unique_ptr pFindBrokerResult( m_pClientFactory->findBrokerAddressInSubscribe(mq.getBrokerName(), MASTER_ID, true)); + if (!pFindBrokerResult) { + LOG_ERROR("lock findBrokerAddressInSubscribe ret null for broker:%s", mq.getBrokerName().data()); + return false; + } unique_ptr lockBatchRequest(new LockBatchRequestBody()); lockBatchRequest->setClientId(m_pConsumer->getMQClientId()); lockBatchRequest->setConsumerGroup(m_pConsumer->getGroupName());