OSError: [Errno 98] Address already in use when calling send function
- Dominant language
- Python
- Stars
- 5.3k
- Forks
- 383
- Avg merge
- 9h 41m
- Merged PRs (30d)
- 2
Description
# Issues
GitHub issues are for bugs. If you have questions, please ask them on the [mailing list](https://groups.io/g/dramatiq-users/topics).
## Checklist
* [x] Does your title concisely summarize the problem?
* [x] Did you include a minimal, reproducible example?
* [x] What OS are you using?
* [x] What version of Dramatiq are you using?
* [x] What did you do?
* [x] What did you expect would happen?
* [x] What happened?
## What OS are you using?
Debian 12
## What version of Dramatiq are you using?
v1.12.0
## What did you do?
I'm using dramatiq in a flask app with flask-melodramatiq. I got an OSError from POST request where dramatiq workers are supposed to run an async job.
## What did you expect would happen?
The task is supposed to be processed successfully
## What happened?
The below error was raised and tasks in queue were not processed but remained for hours. I had to restart flask to solve this issue.
```
Jun 24 02:09:32 c14-irkif docker-kif-web: msg = actor.send(vm, **user_arg_map)
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/dramatiq/actor.py", line 112, in send
Jun 24 02:09:32 c14-irkif docker-kif-web: return self.send_with_options(args=args, kwargs=kwargs)
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/dramatiq/actor.py", line 131, in send_with_options
Jun 24 02:09:32 c14-irkif docker-kif-web: return self.broker.enqueue(message, delay=delay)
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/dramatiq/brokers/rabbitmq.py", line 319, in enqueue
Jun 24 02:09:32 c14-irkif docker-kif-web: self.channel.basic_publish(
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/dramatiq/brokers/rabbitmq.py", line 153, in channel
Jun 24 02:09:32 c14-irkif docker-kif-web: channel = self.state.channel = self.connection.channel()
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/dramatiq/brokers/rabbitmq.py", line 125, in connection
Jun 24 02:09:32 c14-irkif docker-kif-web: connection = self.state.connection = pika.BlockingConnection(
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
Jun 24 02:09:32 c14-irkif docker-kif-web: self._impl = self._create_connection(parameters, _impl_class)
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 435, in _create_connection
Jun 24 02:09:32 c14-irkif docker-kif-web: ioloop = select_connection.IOLoop()
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/adapters/select_connection.py", line 374, in __init__
Jun 24 02:09:32 c14-irkif docker-kif-web: self._poller = self._get_poller(self._get_remaining_interval,
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/adapters/select_connection.py", line 431, in _get_poller
Jun 24 02:09:32 c14-irkif docker-kif-web: poller = SelectPoller(**kwargs)
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/adapters/select_connection.py", line 626, in __init__
Jun 24 02:09:32 c14-irkif docker-kif-web: self._r_interrupt, self._w_interrupt = self._get_interrupt_pair()
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/adapters/select_connection.py", line 916, in _get_interrupt_pair
Jun 24 02:09:32 c14-irkif docker-kif-web: return pika.compat._nonblocking_socketpair() # pylint: disable=W0212
Jun 24 02:09:32 c14-irkif docker-kif-web: File "/usr/local/lib/python3.8/site-packages/pika/compat.py", line 242, in _nonblocking_socketpair
Jun 24 02:09:32 c14-irkif docker-kif-web: lsock.bind((host, 0))
Jun 24 02:09:32 c14-irkif docker-kif-web: OSError: [Errno 98] Address already in use
```
Contributor guide
Assessment
This issue has not been assessed yet.