You are sending messages to mobile phones with msg.send(gateway) , right?
Inside this method, you are connecting to a remote web service that actually sends a message, right?
Then your message could be sent, but your connection to the remote side was not closed, despite the fact that the webservice should have closed it, after sending the message and responding to your request.
The last thing you did not do before creating the socket used to connect to the webservice:
import socket socket.setdefaulttimeout(seconds)
Thus, your task hangs on the socket for an infinite time, waiting for the web service to send a response and / or close the connection. In fact, it would wait forever, if not interrupted by celery timeout .
The default timeout value for the None socket is as specified in the documentation http://docs.python.org/2/library/socket.html#socket.setdefaulttimeout
Hope this will be helpful.
source share