Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] std::bad_function_call was thrown on Reader::ReadNext on a non-persistent topic #455

Open
2 tasks done
zliang-min opened this issue Nov 22, 2024 · 0 comments · May be fixed by #456
Open
2 tasks done

[Bug] std::bad_function_call was thrown on Reader::ReadNext on a non-persistent topic #455

zliang-min opened this issue Nov 22, 2024 · 0 comments · May be fixed by #456

Comments

@zliang-min
Copy link

Search before asking

  • I searched in the issues and found nothing similar.

Version

Pulsar 3.3.2 running in docker, same issue also happen when I tried to connect to StreamNative cloud serivce. But I think this issue has notthing to do with the pulser server side. And I am using pulsar-client-cpp 3.5.1.

Minimal reproduce step

  1. Create a Reader on a non-persistent topic.
  2. Call ReadNext on the Reader instance to read messages.

What did you expect to see?

Messages are successfully read by the client.

What did you see instead?

A portion of the exception backtrace:

0. std::exception::capture() @ 0x00000000245a0b24
1. std::exception::exception[abi:v15000]() @ 0x00000000245a0aec
2. std::__1::bad_function_call::bad_function_call() @ 0x00000000245a0a9c
3. std::__1::__throw_bad_function_call[abi:v15000]() @ 0x00000000245a0a50
4. ? @ 0x000000003e7c3b18
5. ./build_docker/../contrib/llvm-project/libcxx/include/__functional/function.h:848: std::__1::__function::__policy_func<void (pulsar::Result)>::operator()[abi:v15000](pulsar::Result&&) const @ 0x000000003e83edc8
6. ./build_docker/../contrib/llvm-project/libcxx/include/__functional/function.h:1187: std::__1::function<void (pulsar::Result)>::operator()(pulsar::Result) const @ 0x000000003e7db9e4
7. ./build_docker/../contrib/pulsar-cmake/pulsar-client-cpp/lib/AckGroupingTracker.h:93: pulsar::AckGroupingTracker::addAcknowledgeCumulative(pulsar::MessageId const&, std::__1::function<void (pulsar::Result)>) @ 0x000000003e95a38c
8. ./build_docker/../contrib/pulsar-cmake/pulsar-client-cpp/lib/ConsumerImpl.cc:1187: pulsar::ConsumerImpl::acknowledgeCumulativeAsync(pulsar::MessageId const&, std::__1::function<void (pulsar::Result)>) @ 0x000000003e93ce34
9. ./build_docker/../contrib/pulsar-cmake/pulsar-client-cpp/lib/ReaderImpl.cc:155: pulsar::ReaderImpl::acknowledgeIfNecessary(pulsar::Result, pulsar::Message const&) @ 0x000000003ea6a8b0
10. ./build_docker/../contrib/pulsar-cmake/pulsar-client-cpp/lib/ReaderImpl.cc:130: pulsar::ReaderImpl::readNext(pulsar::Message&, int) @ 0x000000003ea6a954
11. ./build_docker/../contrib/pulsar-cmake/pulsar-client-cpp/lib/Reader.cc:49: pulsar::Reader::readNext(pulsar::Message&, int) @ 0x000000003ea66ccc

Anything else?

I think the issue is that, AckGroupingTracker::addAcknowledgeList does check callback before calling it: https://github.com/apache/pulsar-client-cpp/blob/main/lib/AckGroupingTracker.h#L81-L83. And in ReaderImpl::acknowledgeIfNecessary it passes the emptyCallback caused the issue: https://github.com/apache/pulsar-client-cpp/blob/main/lib/ReaderImpl.cc#L155

Are you willing to submit a PR?

  • I'm willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant