You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[2.9.1] With partitioned topics, the Python client returns UnknownError in some cases when it should return a specific error class #15078
Describe the bug
The Python client raises _pulsar.UnknownError: Pulsar error: UnknownError in cases when client logs indicate a specific exception code (for which there is already a specific error subclass) was recieved.
To Reproduce
0. Create a Client object with a Python logger that emits at INFO and above (e.g. logging.getLogger()).
Create a persistent topic with a backlog policy that is very "short", e.g. 1mb.
With a Python producer, send messages to the topic continually until the backlog quota is hit.
Observe that the Python producer errors with an UnknownError rather than ProducerBlockedQuotaExceededException.
Observe that the client logs show the arrival of a ProducerBlockedQuotaExceededException event.
Attempt to re-create the producer on the quota-blocked topic.
Observe that the same issue occurs: logs indicate ProducerBlockedQuotaExceededException, but an UnknownError is raised.
Expected behavior
Specific error classes (the exception classes distributed in the pulsar-client package) should be raised instead of UnknownError when the client can match an error event (visible in the logs) to an exception class: ProducerBlockedQuotaExceededException
I suspect the issue is with the boost-python mapping code; I don't think class-type checks are matching correctly on C++ exception objects.
Example logs:
chariot.chariot.pulsar_client::75192::Dummy-8::WARNING 2022-04-07 18:06:35,902 [127.0.0.1:58048 -> 127.0.0.1:6650] Received error response from server: ProducerBlockedQuotaExceededException (Cannot create producer on topic with backlog quota exceeded) -- req_id: 0
chariot.chariot.pulsar_client::75192::Dummy-8::ERROR 2022-04-07 18:06:35,902 [persistent://chariot1/chariot_namespace_heartbeat/chariot_topic_heartbeat-partition-0, SynchronousChariotProducer-heartbeat-1-ZacBentleyMBP-75192] Failed to create producer: ProducerBlockedQuotaExceededException
chariot.chariot.pulsar_client::75192::Dummy-8::ERROR 2022-04-07 18:06:35,902 Unable to create Producer for partition - 0 Error - ProducerBlockedQuotaExceededException
Example stacktrace which accompanies those logs:
Traceback (most recent call last):
File "/Users/zac.bentley/Desktop/Projects/Klaviyo/chariot/.venv/lib/python3.7/site-packages/pulsar/__init__.py", line 603, in create_producer
p._producer = self._client.create_producer(topic, conf)
_pulsar.UnknownError: Pulsar error: UnknownError
If you can still reproduce this bug on a non-partitioned topic, could you give your OS version? I'll try to reproduce the bug on Ubuntu 18.04 and the Python client 2.9.1 installed by pip3 install on workdays.
I'm working on reproducing on non-partitioned now (focus is split, sorry, results will be here inside the hour). I'm on MacOS, broker 2.9.1 via homebrew, client 2.9.1 via pip, python 3.7.12.
When I create a truly non-partitioned topic, the behavior is correct (I get a ResultProducerBlockedQuotaExceededException on the client). So this bug only happens for partitioned topics. I'll update the title accordingly.
changed the title [-][2.9.1] Python client returns UnknownError in some cases when it should return a specific error class[/-][+][2.9.1] With partitioned topics, the Python client returns UnknownError in some cases when it should return a specific error class[/+]on Apr 10, 2022
Activity
BewareMyPower commentedon Apr 8, 2022
It looks like it works well in my env (macOS, Python 3.9, latest code from master branch).
I modified the C++ code to make producer creation always fail.
The Python script is
zbentley commentedon Apr 10, 2022
I can reproduce with that exact snippet, substituting only my topic name.
The topic is:
When I run the above snippet with my topic name and a backlog that's over quota I get:
BewareMyPower commentedon Apr 10, 2022
Oh, it looks like a bug for partitioned topics. Could you try with a non-partitioned topic?
BewareMyPower commentedon Apr 10, 2022
If you can still reproduce this bug on a non-partitioned topic, could you give your OS version? I'll try to reproduce the bug on Ubuntu 18.04 and the Python client 2.9.1 installed by
pip3 installon workdays.zbentley commentedon Apr 10, 2022
I'm working on reproducing on non-partitioned now (focus is split, sorry, results will be here inside the hour). I'm on MacOS, broker 2.9.1 via homebrew, client 2.9.1 via pip, python 3.7.12.
zbentley commentedon Apr 10, 2022
A topic with a single partition returns the below output; unsure if that's the same as a nonpartitioned topic:
BewareMyPower commentedon Apr 10, 2022
Okay, I'll verify this issue tomorrow.
zbentley commentedon Apr 10, 2022
When I create a truly non-partitioned topic, the behavior is correct (I get a
ResultProducerBlockedQuotaExceededExceptionon the client). So this bug only happens for partitioned topics. I'll update the title accordingly.[-][2.9.1] Python client returns UnknownError in some cases when it should return a specific error class[/-][+][2.9.1] With partitioned topics, the Python client returns UnknownError in some cases when it should return a specific error class[/+]BewareMyPower commentedon Apr 11, 2022
I also reproduced this bug for a partitioned topic.
I will fix this issue soon.
[C++] Fix UnknownError might be returned for a partitioned producer
[C++] Fix UnknownError might be returned for a partitioned producer (#…
[C++] Fix UnknownError might be returned for a partitioned producer (a…
[C++] Fix UnknownError might be returned for a partitioned producer (#…
[C++] Fix UnknownError might be returned for a partitioned producer (#…
[C++] Fix UnknownError might be returned for a partitioned producer (a…
[C++] Fix UnknownError might be returned for a partitioned producer (#…
[C++] Fix UnknownError might be returned for a partitioned producer (a…