zbentley opened a new issue #11823:
URL: https://github.com/apache/pulsar/issues/11823
If a `logger` object (any logger object) is supplied to `pulsar.Client`
objects in Python, its presence can cause arbitrary `async` Python functions to
return `None` incorrectly.
# Steps to reproduce
To reproduce, run the following:
```
import asyncio
import logging
from pulsar import Client
async def async_func(client, rv):
consumer = client.subscribe('sometopic', 'somesub')
consumer.close()
print("async returning", rv)
return rv
if __name__ == '__main__':
client = Client(
service_url='pulsar://localhost:6650/',
logger=logging.getLogger("foo")
)
print("returned:", asyncio.run(async_func(client, "bar")))
```
# Test setup
Python: 3.9
OS: MacOS 10.11
Arch: x86_64
Pulsar broker: 2.8.0 standalone, running locally
Client: `2.8.0.post0`
# Pathology/root cause
This appears to be due to a Boost-python issue (and, in my opinion, a pretty
bad one) I found while trying to track down this behavior:
https://github.com/boostorg/python/issues/374
Unless there is a way to fix that, it looks like **any** invocation of
`pulsar-client`'s Python logger by the C++ code can, in the right
circumstances, corrupt the Python interpreter state and cause the calling
`async` function to return `None` incorrectly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]