Skip to content

Test test_auth_junk_params failed after upgrading C++ client to 3.4.0  #348

Closed

Description

@RobertIndie

I created a PR to upgrade the C++ client to 3.4.0, but the CI failed:

+ python3 pulsar_test.py
2023-11-15 00:23:08.410 INFO  [140130423730624] ClientConnection:188 | [<none> -> pulsar://localhost:6650] Create ClientConnection, timeout=10000
2023-11-15 00:23:08.410 INFO  [140130423730624] ConnectionPool:109 | Created connection for pulsar://localhost:6650
2023-11-15 00:23:08.412 INFO  [140130379408960] ClientConnection:398 | [[::1]:49850 -> [::1]:6650] Connected to broker
2023-11-15 00:23:08.416 INFO  [140130379408960] HandlerBase:83 | [persistent://public/default/test_acknowledge_failed, ] Getting connection from pool
2023-11-15 00:23:08.447 INFO  [140130379408960] ProducerImpl:216 | [persistent://public/default/test_acknowledge_failed, ] Created producer on broker [[::1]:49850 -> [::1]:6650] 
2023-11-15 00:23:08.447 INFO  [140130423730624] Client:86 | Subscribing on Topic :test_acknowledge_failed
2023-11-15 00:23:08.449 INFO  [140130379408960] HandlerBase:83 | [persistent://public/default/test_acknowledge_failed, sub1, 0] Getting connection from pool
2023-11-15 00:23:08.468 INFO  [140130379408960] ConsumerImpl:297 | [persistent://public/default/test_acknowledge_failed, sub1, 0] Created consumer on broker [[::1]:49850 -> [::1]:6650] 
2023-11-15 00:23:08.469 INFO  [140130423730624] Client:86 | Subscribing on Topic :test_acknowledge_failed
2023-11-15 00:23:08.472 INFO  [140130379408960] HandlerBase:83 | [persistent://public/default/test_acknowledge_failed, sub2, 1] Getting connection from pool
2023-11-15 00:23:08.4[80](https://github.com/apache/pulsar-client-python/actions/runs/6848544221/job/18687459291?pr=161#step:9:81) INFO  [140130379408960] ConsumerImpl:297 | [persistent://public/default/test_acknowledge_failed, sub2, 1] Created consumer on broker [[::1]:49850 -> [::1]:6650] 
2023-11-15 00:23:08.510 INFO  [140130379408960] HandlerBase:[83](https://github.com/apache/pulsar-client-python/actions/runs/6848544221/job/18687459291?pr=161#step:9:84) | [persistent://public/default/test_acknowledge_failed, sub, 2] Getting connection from pool
2023-11-15 00:23:08.510 INFO  [140130379408960] HandlerBase:83 | [persistent://public/default/test_acknowledge_failed-another, sub, 3] Getting connection from pool
2023-11-15 00:23:08.516 INFO  [140130379408960] ConsumerImpl:297 | [persistent://public/default/test_acknowledge_failed, sub, 2] Created consumer on broker [[::1]:49[85](https://github.com/apache/pulsar-client-python/actions/runs/6848544221/job/18687459291?pr=161#step:9:86)0 -> [::1]:6650] 
2023-11-15 00:23:08.516 INFO  [140130379408960] MultiTopicsConsumerImpl:304 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 0
2023-11-15 00:23:08.527 INFO  [140130379408960] ConsumerImpl:297 | [persistent://public/default/test_acknowledge_failed-another, sub, 3] Created consumer on broker [[::1]:49850 -> [::1]:6650] 
2023-11-15 00:23:08.527 INFO  [140130379408960] MultiTopicsConsumerImpl:304 | Successfully Subscribed to a single partition of topic in TopicsConsumer. Partitions need to create : 0
2023-11-15 00:23:08.527 INFO  [140130379408960] MultiTopicsConsumerImpl:146 | Successfully Subscribed to Topics
2023-11-15 00:23:08.527 ERROR [140130423730624] MultiTopicsConsumerImpl:663 | MessageId without a topic name cannot be acknowledged for a multi-topics consumer
2023-11-15 00:23:08.527 INFO  [140130423730624] ClientImpl:612 | Closing Pulsar client with 1 producers and 3 consumers
2023-11-15 00:23:08.527 INFO  [140130423730624] ProducerImpl:791 | [persistent://public/default/test_acknowledge_failed, standalone-0-0] Closing producer for topic persistent://public/default/test_acknowledge_failed
2023-11-15 00:23:08.527 INFO  [140130423730624] ConsumerImpl:1258 | [persistent://public/default/test_acknowledge_failed-another, sub, 3] Closing consumer for topic persistent://public/default/test_acknowledge_failed-another
2023-11-15 00:23:08.527 INFO  [140130423730624] ConsumerImpl:1258 | [persistent://public/default/test_acknowledge_failed, sub, 2] Closing consumer for topic persistent://public/default/test_acknowledge_failed
2023-11-15 00:23:08.527 INFO  [140130423730624] ConsumerImpl:1258 | [persistent://public/default/test_acknowledge_failed, sub2, 1] Closing consumer for topic persistent://public/default/test_acknowledge_failed
2023-11-15 00:23:08.527 INFO  [140130423730624] ConsumerImpl:1258 | [persistent://public/default/test_acknowledge_failed, sub1, 0] Closing consumer for topic persistent://public/default/test_acknowledge_failed
2023-11-15 00:23:08.535 INFO  [14013037940[89](https://github.com/apache/pulsar-client-python/actions/runs/6848544221/job/18687459291?pr=161#step:9:90)60] ProducerImpl:755 | [persistent://public/default/test_acknowledge_failed, standalone-0-0] Closed producer 0
2023-11-15 00:23:08.535 INFO  [140130379408960] ConsumerImpl:1244 | [persistent://public/default/test_acknowledge_failed-another, sub, 3] Closed consumer 3
2023-11-15 00:23:08.535 INFO  [140130379408960] ConsumerImpl:1244 | [persistent://public/default/test_acknowledge_failed, sub, 2] Closed consumer 2
2023-11-15 00:23:08.535 INFO  [140130379408960] ConsumerImpl:1244 | [persistent://public/default/test_acknowledge_failed, sub2, 1] Closed consumer 1
2023-11-15 00:23:08.535 INFO  [140130379408960] ConsumerImpl:1244 | [persistent://public/default/test_acknowledge_failed, sub1, 0] Closed consumer 0
2023-11-15 00:23:08.536 INFO  [140130018915[90](https://github.com/apache/pulsar-client-python/actions/runs/6848544221/job/18687459291?pr=161#step:9:91)4] ClientConnection:1319 | [[::1]:49850 -> [::1]:6650] Connection disconnected (refCnt: 1)
2023-11-15 00:23:08.536 INFO  [140130018915904] ClientConnection:268 | [[::1]:49850 -> [::1]:6650] Destroyed connection to pulsar://localhost:6650
.terminate called after throwing an instance of 'std::bad_weak_ptr'
  what():  bad_weak_ptr
2023-11-15 00:23:08.536 INFO  [140130423730624] ProducerImpl:748 | Producer - [persistent://public/default/test_acknowledge_failed, standalone-0-0] , [batching  = off]

Test failures:

Activity

  1. RobertIndie commented on Nov 16, 2023

    @RobertIndie
    MemberAuthor

    The core dump stack trace:

    #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140123919167936) at ./nptl/pthread_kill.c:44
    apache/pulsar-client-python#1  __pthread_kill_internal (signo=6, threadid=140123919167936) at ./nptl/pthread_kill.c:78
    apache/pulsar-client-python#2  __GI___pthread_kill (threadid=140123919167936, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
    apache/pulsar-client-python#3  0x00007f7124716476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
    apache/pulsar-client-python#4  0x00007f71246fc7f3 in __GI_abort () at ./stdlib/abort.c:79
    apache/pulsar-client-python#5  0x00007f7122e47b9e in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    apache/pulsar-client-python#6  0x00007f7122e5320c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    apache/pulsar-client-python#7  0x00007f7122e521e9 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
    apache/pulsar-client-python#8  0x00007f7122e52959 in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6
    apache/pulsar-client-python#9  0x00007f7124001884 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    apache/pulsar-client-python#10 0x00007f7124001f41 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    apache/pulsar-client-python#11 0x00007f7122e534cb in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
    apache/pulsar-client-python#12 0x00007f71233d0c54 in std::__throw_bad_weak_ptr () at /usr/include/c++/11/bits/shared_ptr_base.h:93
    apache/pulsar-client-python#13 0x00007f71233d8b99 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count (this=0x7ffebcd6ee98, __r=...) at /usr/include/c++/11/bits/shared_ptr_base.h:873
    apache/pulsar-client-python#14 0x00007f71234b95a9 in std::__shared_ptr<pulsar::ClientConnection, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<pulsar::ClientConnection, void> (this=0x7ffebcd6ee90, __r=...)
        at /usr/include/c++/11/bits/shared_ptr_base.h:1178
    apache/pulsar-client-python#15 0x00007f71234b33b5 in std::shared_ptr<pulsar::ClientConnection>::shared_ptr<pulsar::ClientConnection, void> (this=0x7ffebcd6ee90,
        __r=std::weak_ptr<pulsar::ClientConnection> (empty) = {...}) at /usr/include/c++/11/bits/shared_ptr.h:326
    apache/pulsar-client-python#16 0x00007f71234ae357 in std::enable_shared_from_this<pulsar::ClientConnection>::shared_from_this (this=0x55e805fc0a50) at /usr/include/c++/11/bits/shared_ptr.h:808
    apache/pulsar-client-python#17 0x00007f71234a8808 in pulsar::ClientConnection::weak_from_this (this=0x55e805fc0a50) at /code/pulsar-client-cpp/lib/ClientConnection.h:136
    apache/pulsar-client-python#18 0x00007f712343c98d in pulsar::ClientConnection::close (this=0x55e805fc0a50, result=pulsar::ResultAuthenticationError, detach=false)
        at /code/pulsar-client-cpp/lib/ClientConnection.cc:1327
    apache/pulsar-client-python#19 0x00007f71234300fe in pulsar::ClientConnection::ClientConnection (this=0x55e805fc0a50, logicalAddress="pulsar+ssl://localhost:6651",
        physicalAddress="pulsar+ssl://localhost:6651", executor=std::shared_ptr<pulsar::ExecutorService> (use count 3, weak count 1) = {...}, clientConfiguration=...,
        authentication=std::shared_ptr<pulsar::Authentication> (empty) = {...}, clientVersion="Pulsar-CPP-v3.4.0-pre", pool=...)
        at /code/pulsar-client-cpp/lib/ClientConnection.cc:219
    apache/pulsar-client-python#20 0x00007f7123566e26 in pulsar::ConnectionPool::getConnectionAsync (this=0x55e805ca4240, logicalAddress="pulsar+ssl://localhost:6651",
        physicalAddress="pulsar+ssl://localhost:6651") at /code/pulsar-client-cpp/lib/ConnectionPool.cc:98
    apache/pulsar-client-python#21 0x00007f71233f6ef8 in pulsar::BinaryProtoLookupService::getPartitionMetadataAsync (this=0x7f711c004090,
        topicName=std::shared_ptr<pulsar::TopicName> (use count 3, weak count 0) = {...}) at /code/pulsar-client-cpp/lib/BinaryProtoLookupService.cc:112
    apache/pulsar-client-python#22 0x00007f71234e64b5 in pulsar::RetryableLookupService::getPartitionMetadataAsync(std::shared_ptr<pulsar::TopicName> const&)::{lambda()#1}::operator()() const (
        __closure=0x55e805f4dc50) at /code/pulsar-client-cpp/lib/RetryableLookupService.h:61
    
  2. BewareMyPower commented on Nov 16, 2023

    @BewareMyPower
    Contributor

    From your dump, the client version is still "Pulsar-CPP-v3.4.0-pre". Did you use the v3.4.0 tag? Also it's weird to see the logical address is pulsar+ssl://localhost:6651 if you ran test_acknowledge_failed.

    Did you test this single method

    python3 ./tests/pulsar_test.py PulsarTest.test_acknowledge_failed

    or the whole test?

    python3 ./tests/pulsar_test.py
  3. BewareMyPower commented on Nov 16, 2023

    @BewareMyPower
    Contributor

    I tested the pulsar_test.py on macOS with the C++ library built from source. No test failed.

    I believe there is something wrong with the DEB package or the Ubuntu test environment in CI. I will test on Ubuntu later.

  4. RobertIndie commented on Nov 16, 2023

    @RobertIndie
    MemberAuthor

    I could only reproduce it by running the whole test: python3 ./tests/pulsar_test.py

    Did you use the v3.4.0 tag?

    I need to check it further. But the test could also fails in CI which uses v3.4.0 tag.

  5. BewareMyPower commented on Nov 16, 2023

    @BewareMyPower
    Contributor

    Sorry there is something wrong with my installation. I have installed both the libpulsar from HomeBrew and the C++ client locally. So the Python extension links to the system libpulsar when running.

    So I linked the correct path via

    export DYLD_LIBRARY_PATH=$HOME/softwares/pulsar-client-cpp/lib 

    and reproduced the error:

    $ python3 tests/pulsar_test.py PulsarTest.test_auth_junk_params
    ...
    ======================================================================
    ERROR: test_auth_junk_params (__main__.PulsarTest.test_auth_junk_params)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/pulsar-client-python/tests/pulsar_test.py", line 519, in test_auth_junk_params
        client.subscribe("my-python-topic-auth-junk-params", "my-sub", consumer_type=ConsumerType.Shared)
      File "/opt/homebrew/lib/python3.11/site-packages/pulsar/__init__.py", line 946, in subscribe
        c._consumer = self._client.subscribe(topic, subscription_name, conf)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: bad_weak_ptr
    

    The test failure should be test_auth_junk_params, not `test_acknowledge_failed.

  6. changed the title [-]Test `test_acknowledge_failed ` failed after upgrading C++ client to 3.4.0 [/-] [+]Test `test_auth_junk_params` failed after upgrading C++ client to 3.4.0 [/+] on Nov 16, 2023
  7. BewareMyPower commented on Nov 16, 2023

    @BewareMyPower
    Contributor

    Here are the stacks on macOS (lldb)

      * frame #0: 0x000000018272ec54 libc++abi.dylib`__cxa_throw
        frame apache/pulsar-client-python#1: 0x000000011003ca14 libpulsar.dylib`std::__1::__throw_bad_weak_ptr[abi:v15006]() at shared_ptr.h:139:5
        frame apache/pulsar-client-python#2: 0x000000011003c9cc libpulsar.dylib`std::__1::shared_ptr<pulsar::AckGroupingTracker>::shared_ptr[abi:v15006]<pulsar::AckGroupingTracker, void>(this=0x000000016fdfb188, __r=nullptr) at shared_ptr.h:636:13
        frame apache/pulsar-client-python#3: 0x000000011003c92c libpulsar.dylib`std::__1::shared_ptr<pulsar::AckGroupingTracker>::shared_ptr[abi:v15006]<pulsar::AckGroupingTracker, void>(this=0x000000016fdfb188, __r=nullptr) at shared_ptr.h:634:5
        frame apache/pulsar-client-python#4: 0x00000001100a45e0 libpulsar.dylib`std::__1::enable_shared_from_this<pulsar::ClientConnection>::shared_from_this[abi:v15006](this=0x000000010102b800) at shared_ptr.h:1729:17
        frame apache/pulsar-client-python#5: 0x00000001100a2c30 libpulsar.dylib`pulsar::ClientConnection::close(this=0x000000010102b800, result=ResultAuthenticationError, detach=false) at ClientConnection.cc:1326:17
        frame apache/pulsar-client-python#6: 0x00000001100a1128 libpulsar.dylib`pulsar::ClientConnection::ClientConnection(this=0x000000010102b800, logicalAddress="pulsar+ssl://localhost:6651", physicalAddress="pulsar+ssl://localhost:6651", executor=std::__1::shared_ptr<pulsar::ExecutorService>::element_type @ 0x0000600003704198 strong=3 weak=2, clientConfiguration=0x0000000101029f78, authentication=nullptr, clientVersion="Pulsar-CPP-v3.4.0", pool=0x0000000101029f78) at ClientConnection.cc:219:13
        frame apache/pulsar-client-python#7: 0x00000001100a39d4 libpulsar.dylib`pulsar::ClientConnection::ClientConnection(this=0x000000010102b800, logicalAddress="pulsar+ssl://localhost:6651", physicalAddress="pulsar+ssl://localhost:6651", executor=<unavailable>, clientConfiguration=0x0000000101029f78, authentication=nullptr, clientVersion="Pulsar-CPP-v3.4.0", pool=0x0000000101029f78) at ClientConnection.cc:187:19
        frame apache/pulsar-client-python#8: 0x000000011020ba0c libpulsar.dylib`pulsar::ConnectionPool::getConnectionAsync(this=0x0000000101029f78, logicalAddress="pulsar+ssl://localhost:6651", physicalAddress="pulsar+ssl://localhost:6651", keySuffix=0) at ConnectionPool.cc:99:23
        frame apache/pulsar-client-python#9: 0x000000011005d3dc libpulsar.dylib`pulsar::ConnectionPool::getConnectionAsync(this=0x0000000101029f78, logicalAddress="pulsar+ssl://localhost:6651", physicalAddress="pulsar+ssl://localhost:6651") at ConnectionPool.h:82:16
        frame apache/pulsar-client-python#10: 0x000000011005d078 libpulsar.dylib`pulsar::BinaryProtoLookupService::getPartitionMetadataAsync(this=0x0000600003300298, topi
    
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