I made a Discord Bot using Python 3.6. It runs and behaves perfectly when run on my computer, yet when I run it on PythonAnywhere, I get this message. I installed Discord.py and all necessary modules. Please help. I am not that very good with complex programming talk, and not at all good with web talk, so please answer as simply as you can. Does this issue only happen with PythonAnywhere or all remote hosting sites?
01:42 ~ $ python3.6 MyCoolBot.py
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direc
t_connection
local_addr=self._local_addr)
File "/usr/lib/python3.6/asyncio/base_events.py", line 778, in create_connection
raise exceptions[0]
File "/usr/lib/python3.6/asyncio/base_events.py", line 765, in create_connection
yield from self.sock_connect(sock, address)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 450, in sock_connect
return (yield from fut)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 480, in _sock_connect_cb
raise OSError(err, 'Connect call failed %s' % (address,))
ConnectionRefusedError: [Errno 111] Connect call failed ('104.16.58.5', 443)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect
yield from self._create_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_conne
ction
transport, proto = yield from self._create_direct_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direc
t_connection
(req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Can not connect to discordapp.com:443 [Connect call failed ('104.16.
58.5', 443)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "MyCoolBot.py", line 39, in <module>
client.run('MY_BOT_TOKEN')
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 490, in start
yield from self.login(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 416, in login
yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1
data = yield from self.http.static_login(token, bot=is_bot)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 258, in static_login
data = yield from self.request(Route('GET', '/users/#me'))
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 137, in request
r = yield from self.session.request(method, url, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 555, in __iter__
resp = yield from self._coro
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
conn = yield from self._connector.connect(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect
.format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.58.5', 443)]]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4b25d81be0>
This is because PythonAnywhere requires a proxy in such a way that the aiohttp websockets don't support. There's a thread on their forums about it here: https://www.pythonanywhere.com/forums/topic/7384/ (See #Patrick Haugh's comment above)
I have experience running pymysql because it always return
the following error
Traceback (most recent call last):
File "synch.py", line 69, in <module>
db = pymysql.connect(host='localhost',user='root',password='mypassword',db='mytable',charset='utf8')
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/__init__.py", line 94, in Connect
return Connection(*args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/connections.py", line 327, in __init__
self.connect()
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/connections.py", line 587, in connect
self._get_server_information()
File "/home/pi/.local/lib/python2.7/site-packages/pymysql/connections.py", line 976, in _get_server_information
self.server_version = data[i:server_end].decode('latin1')
LookupError: unknown encoding: latin1
I made a Discord Bot using Python 3.6. It runs and behaves perfectly when run on my computer, yet when I run it on PythonAnywhere, I get this message. I installed Discord.py and all necessary modules. Please help. I am not that very good with complex programming talk, and not at all good with web talk, so please answer as simply as you can. Does this issue only happen with PythonAnywhere or all remote hosting sites?
01:42 ~ $ python3.6 MyCoolBot.py
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direc
t_connection
local_addr=self._local_addr)
File "/usr/lib/python3.6/asyncio/base_events.py", line 778, in create_connection
raise exceptions[0]
File "/usr/lib/python3.6/asyncio/base_events.py", line 765, in create_connection
yield from self.sock_connect(sock, address)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 450, in sock_connect
return (yield from fut)
File "/usr/lib/python3.6/asyncio/selector_events.py", line 480, in _sock_connect_cb
raise OSError(err, 'Connect call failed %s' % (address,))
ConnectionRefusedError: [Errno 111] Connect call failed ('104.16.58.5', 443)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect
yield from self._create_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_conne
ction
transport, proto = yield from self._create_direct_connection(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direc
t_connection
(req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Can not connect to discordapp.com:443 [Connect call failed ('104.16.
58.5', 443)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "MyCoolBot.py", line 39, in <module>
client.run('MY_BOT_TOKEN')
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 519, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 490, in start
yield from self.login(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 416, in login
yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1
data = yield from self.http.static_login(token, bot=is_bot)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 258, in static_login
data = yield from self.request(Route('GET', '/users/#me'))
File "/home/CompuGenius/.local/lib/python3.6/site-packages/discord/http.py", line 137, in request
r = yield from self.session.request(method, url, **kwargs)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 555, in __iter__
resp = yield from self._coro
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
conn = yield from self._connector.connect(req)
File "/home/CompuGenius/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect
.format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.58.5', 443)]]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f4b25d81be0>
This is because PythonAnywhere requires a proxy in such a way that the aiohttp websockets don't support. There's a thread on their forums about it here: https://www.pythonanywhere.com/forums/topic/7384/ (See #Patrick Haugh's comment above)
I am trying to run the remote manager example code from the multiprocessing documentation in pypy3 but I get an error connecting the client.
Traceback (most recent call last):
File "C:/temp/testpypy/mp_client.py", line 7, in <module>
m.connect()
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\managers.py", line 455, in connect
conn = Client(self._address, authkey=self._authkey)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 493, in Client
answer_challenge(c, authkey)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 732, in answer_challenge
message = connection.recv_bytes(256) # reject large message
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "C:\Python\pypy3-v6.0.0-win32\lib-python\3\multiprocessing\connection.py", line 386, in _recv
buf.write(chunk)
TypeError: 'str' does not support the buffer interface
if I try to connect to it from a CPython interpreter (which is my ultimate goal) I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\managers.py", line 455, in connect
conn = Client(self._address, authkey=self._authkey)
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 493, in Client
answer_challenge(c, authkey)
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 737, in answer_challenge
response = connection.recv_bytes(256) # reject large message
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 218, in recv_bytes
self._bad_message_length()
File "c:\Python\3.5.4.2\WinPython\python-3.5.4.amd64\lib\multiprocessing\connection.py", line 151, in _bad_message_length
raise OSError("bad message length")
OSError: bad message length
Turns out to be a bug in PyPy3.
Here is the fixed ticket:
https://bitbucket.org/pypy/pypy/issues/2841/remote-multprocessing-issue#comment-45861347
I am not able to figure this out. I have flask app with celery and using Redis as a broker on Ubuntu 16.04. It was working fine for the last many days and today all of a sudden it is giving the following exception. Works fine locally on my OSX. Fails on the ubuntu virtual server.
[2017-07-26 20:12:25,512: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 2165, in _execute
return command(*args)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
response = self._parser.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
response = self._buffer.readline()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
self._read_from_socket()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
(e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
raise err
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/worker/consumer/consumer.py", line 318, in start
blueprint.start(self)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/worker/consumer/consumer.py", line 594, in start
c.loop(*c.loop_args())
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/worker/loops.py", line 88, in asynloop
next(loop)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/async/hub.py", line 345, in create_loop
cb(*cbargs)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 1039, in on_readable
self.cycle.on_readable(fileno)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 337, in on_readable
chan.handlers[type]()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 667, in _receive
ret.append(self._receive_one(c))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 678, in _receive_one
response = c.parse_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 2183, in parse_response
return self._execute(connection, connection.read_response)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 2172, in _execute
connection.connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
[2017-07-26 20:12:25,804: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: Error 111 connecting to localhost:6379. Connection refused..
Trying again in 2.00 seconds...
[2017-07-26 20:12:26,725: ERROR/PoolWorker-3] Something went wrong in async processes.
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/tasks.py", line 66, in send_event_notification_async
sleep(nextEventDelayInSeconds)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/common.py", line 125, in _shutdown_cleanup
sys.exit(-(256 - signum))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/pool.py", line 281, in exit
return _exit()
SystemExit
[2017-07-26 20:12:26,726: ERROR/PoolWorker-4] Something went wrong in async processes.
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/tasks.py", line 66, in send_event_notification_async
sleep(nextEventDelayInSeconds)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/common.py", line 125, in _shutdown_cleanup
sys.exit(-(256 - signum))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/pool.py", line 281, in exit
return _exit()
SystemExit
[2017-07-26 20:12:26,734: ERROR/PoolWorker-8] Something went wrong in async processes.
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/tasks.py", line 66, in send_event_notification_async
sleep(nextEventDelayInSeconds)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/common.py", line 125, in _shutdown_cleanup
sys.exit(-(256 - signum))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/pool.py", line 281, in exit
return _exit()
SystemExit
[2017-07-26 20:12:27,729: ERROR/MainProcess] Process 'PoolWorker-6' pid:2057 exited with 'signal 15 (SIGTERM)'
[2017-07-26 20:12:27,740: ERROR/MainProcess] Process 'PoolWorker-5' pid:2055 exited with 'exitcode 15'
[2017-07-26 20:12:27,750: ERROR/MainProcess] Process 'PoolWorker-2' pid:2052 exited with 'exitcode 15'
[2017-07-26 20:12:27,761: ERROR/MainProcess] Process 'PoolWorker-1' pid:2051 exited with 'exitcode 15'
[2017-07-26 20:12:27,812: ERROR/MainProcess] Process 'PoolWorker-7' pid:2059 exited with 'exitcode 15'
[2017-07-26 20:13:27,799: ERROR/PoolWorker-3] Something went wrong in async processes.
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 573, in execute_command
return self.parse_response(connection, command_name, **options)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 585, in parse_response
response = connection.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
response = self._parser.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
response = self._buffer.readline()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
self._read_from_socket()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
(e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
raise err
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/tasks.py", line 45, in send_event_notification_async
r.set(priority, True)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 1072, in set
return self.execute_command('SET', *pieces)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
connection.send_command(*args)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
[2017-07-26 20:13:27,800: ERROR/PoolWorker-4] Something went wrong in async processes.
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 573, in execute_command
return self.parse_response(connection, command_name, **options)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 585, in parse_response
response = connection.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
response = self._parser.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
response = self._buffer.readline()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
self._read_from_socket()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
(e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
raise err
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/tasks.py", line 45, in send_event_notification_async
r.set(priority, True)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 1072, in set
return self.execute_command('SET', *pieces)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
connection.send_command(*args)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
[2017-07-26 20:13:27,802: ERROR/PoolWorker-8] Something went wrong in async processes.
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 573, in execute_command
return self.parse_response(connection, command_name, **options)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 585, in parse_response
response = connection.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
response = self._parser.read_response()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
response = self._buffer.readline()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
self._read_from_socket()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
(e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
sock = self._connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
raise err
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dsangvikar/apps/msbot/tasks.py", line 45, in send_event_notification_async
r.set(priority, True)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 1072, in set
return self.execute_command('SET', *pieces)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
connection.send_command(*args)
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
self.connect()
File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
I guess it retries after 2 seconds and again fails and the same exceptions. What is more confusing is redis-server is up and running properly. redis-cli ping works. Further more, I opened up redis-cli and tried to get the values which the celery worker is supposed to add. Those are also gettable. Btw, I flush all the values on server restart. So when I restarted the server, it updated the values accordingly. How do I figure out what's wrong?
I didn't make any changes on the redis-server configuration files. All ways working well till yesterday.
edit: What is suprising is that I get this error 'ConnectionRefusedError: [Errno 111] Connection refused' after some of the statements have been executed. So basically it connects to the redis db, puts in the values and then fails. What?