Visitar URL original
Producer can not be started in UWSGI, and raises a rocketmq.exceptions.ProducerStartFailed · Issue #140 · apache/rocketmq-client-python · GitHub
Skip to content

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

Description

@a2htray

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

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.

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions