Skip to content

When use pulsar::Message msg = pulsar::MessageBuilder().setContent(sMsg).build() to Create Message, sometimes it will occur segment fault #476

Open

Description

@liyinxin

(gdb) bt
#0 pop (this=0x7f2b58df7900) at pulsar-client-3.4/lib/ObjectPool.h:74
#1 allocate (this=0x7f2b58df7900) at pulsar-client-3.4/lib/ObjectPool.h:134
#2 allocate (n=1, this=) at pulsar-client-3.4/lib/ObjectPool.h:167
#3 allocate (__a=, __n=1) at /usr/local/gcc-4.9.3/include/c++/4.9.3/bits/alloc_traits.h:357
#4 __shared_count<pulsar::MessageImpl, pulsar::Allocator<pulsar::MessageImpl, 100000> > (__a=..., this=0x7f2b3e589ea8)
at /usr/local/gcc-4.9.3/include/c++/4.9.3/bits/shared_ptr_base.h:616
#5 __shared_ptr<pulsar::Allocator<pulsar::MessageImpl, 100000> > (__a=..., __tag=..., this=0x7f2b3e589ea0,
this@entry=<error reading variable: Cannot access memory at address 0x7f2b3e589e98>)
at /usr/local/gcc-4.9.3/include/c++/4.9.3/bits/shared_ptr_base.h:1090
#6 shared_ptr<pulsar::Allocator<pulsar::MessageImpl, 100000> > (__a=..., __tag=..., this=0x7f2b3e589ea0)
at /usr/local/gcc-4.9.3/include/c++/4.9.3/bits/shared_ptr.h:316
#7 allocate_shared<pulsar::MessageImpl, pulsar::Allocator<pulsar::MessageImpl, 100000> > (__a=...)
at /usr/local/gcc-4.9.3/include/c++/4.9.3/bits/shared_ptr.h:588
#8 create (this=0x2622ba0 pulsar::messagePool) at pulsar-client-3.4/lib/ObjectPool.h:212
#9 pulsar::MessageBuilder::createMessageImpl () at pulsar-client-3.4/lib/MessageBuilder.cc:42

(gdb) print head_
Cannot access memory at address 0x7f2b58df7900
(gdb) print result
$1 = (void *) 0x1

void* pop() {
if (!head_) {
// size = 0
std::lock_guardstd::mutex lock(mutex_);

            if (!globalPool_) {
                return NULL;
            }

            GlobalPool* poolEntry = globalPool_;
            head_ = globalPool_->node_;
            pushSize_ += globalPool_->nodeCount_;
            globalNodeCount_ -= globalPool_->nodeCount_;
            globalPool_ = globalPool_->next_;
            delete poolEntry;
        }
        void* result = head_;
        if (result) {
            head_ = head_->next;
            pushSize_--;
        }
        return result;
    }

Activity

  1. lhotari commented on Feb 17, 2025

    @lhotari
    Member

    @liyinxin Thanks for the report. Can you also reproduce with latest release of pulsar-client-cpp which is 3.7.0 ?

  2. liyinxin commented on Feb 18, 2025

    @liyinxin
    Author

    @liyinxin Thanks for the report. Can you also reproduce with latest release of pulsar-client-cpp which is 3.7.0 ?

    I Use the pulsar-client-cpp 3.7.0 today, it will wait some time to check it can reproduce the problem

  3. liyinxin commented on Feb 21, 2025

    @liyinxin
    Author

    Yes, It can also reproduce in with latest release of pulsar-client-cpp which is 3.7.0 @lhotari

  4. BewareMyPower commented on Feb 21, 2025

    @BewareMyPower
    Contributor

    Did you use RPM packages? Could you try a higher version of GCC and see if this would happen again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions