apache / apache/rocketmq-client-python

Producer can not be started in UWSGI, and raises a rocketmq.exceptions.ProducerStartFailed

Aperta
#140 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
305
Fork
98
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

My application is deveplped with Django which provides a Web API service and runs over UWSGI. The real code is as follows:

```python
mq_locals = {}

def get_producer() -> Producer:
if 'producer' not in mq_locals:
producer = Producer('XXX')
producer.set_namesrv_addr(settings.ODMS_CONFIG['name_server']) # pylint: disable=E1101
producer.start()

mq_locals['producer'] = producer

return mq_locals['producer']
```

But the application raises a `rocketmq.exceptions.ProducerStartFailed: boost::thread_resource_error: Resource temporarily unavailable` when the `get_producer` method is called.

The version of `rocketmq-client-python` and `rocketmq` are **2.0.0** and **0.4.4** respectively. And the OS is Ubuntu. The Detailed log is as follows.

```bash
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.7/site-packages/django/views/decorators/http.py", line 40, in inner
return func(request, *args, **kwargs)
File "/dc_utils3/dc_account_md/decorators.py", line 29, in _wrapped_view
return view_func(request, *args, **kwargs)
File "./odms/views/submission_approve.py", line 64, in submission_approve
send_approve_message(submission.archive_id, mq_srv.APPROVE_STATUS_YES, comment)
File "./odms/views/submission_approve.py", line 74, in send_approve_message
mq_srv.send_approve_message(archive_id, approve_status, comment)
File "./odms/services/mq.py", line 58, in send_approve_message
echo_producer = get_producer()
File "./odms/services/mq.py", line 30, in get_producer
producer.start()
File "/usr/local/lib/python3.7/site-packages/rocketmq/client.py", line 329, in start
ffi_check(dll.StartProducer(self._handle))
File "/usr/local/lib/python3.7/site-packages/rocketmq/exceptions.py", line 27, in ffi_check
raise exc_cls(msg)
rocketmq.exceptions.ProducerStartFailed: boost::thread_resource_error: Resource temporarily unavailable
```

In addition, the `get_producer` method is call normally in Django console.

![image](https://github.com/apache/rocketmq-client-python/assets/12782530/4b5aedba-416d-40fc-bbc1-8ea25ad88765)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.