-
Notifications
You must be signed in to change notification settings - Fork 43
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
Segmentation fault for acknowledge_cumulative #114
Comments
The cumulative acknowledgment cannot be used for Key_Shared subscription. I think we need to enhance the error processing at the Python client side. We should return an error instead of crash. BTW, I cannot reproduce this issue with the following code with Python client 3.1.0 and Pulsar standalone 2.11.0. from pulsar import Client, ConsumerType, InitialPosition
pulsar_client = Client('pulsar://localhost:6650')
topic = 'my-topic'
producer = pulsar_client.create_producer(topic=topic)
producer.send('msg-0'.encode())
producer.send('msg-1'.encode())
producer.close()
consumer = pulsar_client.subscribe(
topic=topic,
subscription_name='sub',
initial_position=InitialPosition.Earliest,
consumer_type=ConsumerType.KeyShared,
)
msg = consumer.receive()
print(f'{msg.data()} | {msg.message_id()}')
msg = consumer.receive()
print(f'{msg.data()} | {msg.message_id()}')
consumer.acknowledge_cumulative(msg)
pulsar_client.close() Output:
The cumulative acknowledgment just fail without any exception thrown. |
Thanks for checking. Improving the error handling python side sounds good and perhaps a docs update (https://pulsar.apache.org/api/python/3.1.x/pulsar.Consumer.html#acknowledge_cumulative). On the reproducibility, perhaps the environment makes a difference, error was seen on Ubuntu 22.04, python 3.10.6 |
I just rechecked the code and found pulsar-client-python/src/consumer.cc Line 53 in cf4a9c0
So no exception should be thrown even if it failed. I tested the code here inside a |
Fixes apache#114 ### Motivation Currently the `acknowledge` and `acknowledge_cumulative` methods are all asynchronous. Even if any error happened, no exception would be raised. For example, when acknowledging cumulatively on a consumer whose consumer type is Shared or KeyShared, no error happens. ### Modifications - Change these methods to synchronous and raise exceptions if the acknowledgment failed. - Add `PulsarTest.test_acknowledge_failed` to test these failed cases. - Improve the documents to describe which exceptions could be raised in which cases.
Fixes #114 ### Motivation Currently the `acknowledge` and `acknowledge_cumulative` methods are all asynchronous. Even if any error happened, no exception would be raised. For example, when acknowledging cumulatively on a consumer whose consumer type is Shared or KeyShared, no error happens. ### Modifications - Change these methods to synchronous and raise exceptions if the acknowledgment failed. - Add `PulsarTest.test_acknowledge_failed` to test these failed cases. - Improve the documents to describe which exceptions could be raised in which cases.
Describe the bug
Trying to use the consumer acknowledge_cumulative(msg) functionality. The python shell stops with Segmentation fault (core dumped). Expected is to ack the messages until the current message in the stream or at least to have error handling available to the python interpreter.
To Reproduce
1、Test Conditions
2、Test code
error log
Starting shell with
python3 -q -X faulthandler
The text was updated successfully, but these errors were encountered: