PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

Websocket crashes the bot

Open kureijir opened this issue 10 years ago • 0 comments

Expected Behavior

Actual Behavior

Sometimes bot crashes.

Your FULL config.json (remove your username, password, gmapkey and any other private info)

http://pastebin.com/Wb3HZvk2 Well I don't think full config is needed here, since the problem lies in these lines

    "websocket": {
        "start_embedded_server": true,
        "server_url": "0.0.0.0:4000"
    }

Output when issue occurred

[2016-09-22 04:58:06] [MoveToFort] [INFO] Moving towards pokestop AA Gun Display - 0.11km
[2016-09-22 04:58:08] [       cli] [INFO]
[2016-09-22 04:58:08] [       cli] [INFO] Ran for 9:12:47
[2016-09-22 04:58:08] [       cli] [INFO] Total XP Earned: 37795  Average: 4102.32/h
[2016-09-22 04:58:08] [       cli] [INFO] Travelled 4.65km
[2016-09-22 04:58:08] [       cli] [INFO] Visited 83 stops
[2016-09-22 04:58:08] [       cli] [INFO] Encountered 85 pokemon, 76 caught, 0 released, 42 evolved, 0 never seen before ()
[2016-09-22 04:58:08] [       cli] [INFO] Threw 162 pokeballs
[2016-09-22 04:58:08] [       cli] [INFO] Earned -111452 Stardust
[2016-09-22 04:58:08] [       cli] [INFO] Hatched eggs 1
[2016-09-22 04:58:08] [       cli] [INFO] Next egg hatches in 2.16 km
[2016-09-22 04:58:08] [       cli] [INFO]
[2016-09-22 04:58:08] [       cli] [INFO] Highest CP Pokemon: Snorlax [CP: 2177] [IV: 15/7/15] Potential: 0.82
[2016-09-22 04:58:08] [       cli] [INFO] Most Perfect Pokemon: Horsea [CP: 220] [IV: 12/15/14] Potential: 0.91
Traceback (most recent call last):
  File "pokecli.py", line 843, in <module>
    main()
  File "pokecli.py", line 296, in main
    formatted='Forts cached.'
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/pokemongo_bot/event_manager.py", line 77, in emit
    handler.handle_event(event, sender, level, formatted_msg, data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/pokemongo_bot/event_handlers/socketio_handler.py", line 28, in handle_event
    'data': data
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/__init__.py", line 429, in emit
    self._message(str(socketIO_packet_type) + socketIO_packet_data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/__init__.py", line 28, in wrap
    return f(*args, **kw)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/__init__.py", line 225, in _message
    transport.send_packet(engineIO_packet_type, engineIO_packet_data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/transports.py", line 162, in send_packet
    self._connection.send(packet)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 239, in send
    return self.send_frame(frame)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 264, in send_frame
    l = self._send(data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 425, in _send
    return send(self.sock, data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_socket.py", line 112, in send
    return sock.send(data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 379, in send
    return self._send_loop(self.fd.send, data, flags)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 374, in _send_loop
    timeout_exc=socket.timeout("timed out"))
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 203, in _trampoline
    mark_as_closed=self._mark_as_closed)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/__init__.py", line 160, in trampoline
    listener = hub.add(hub.WRITE, fileno, current.switch, current.throw, mark_as_closed)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/epolls.py", line 49, in add
    listener = BaseHub.add(self, evtype, fileno, cb, tb, mac)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 177, in add
    evtype, fileno, evtype, cb, bucket[fileno]))
RuntimeError: Second simultaneous write on fileno 18 detected.  Unless you really know what you're doing, make sure that only one greenthread can write any particular socket.  Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.debug.hub_prevent_multiple_readers(False) - MY THREAD=<built-in method switch of greenlet.greenlet object at 0xb4972f30>; THAT THREAD=FdListener('write', 18, <built-in method switch of greenlet.greenlet object at 0xb4241530>, <built-in method throw of greenlet.greenlet object at 0xb4241530>)
[2016-09-22 04:58:08] [sentry.errors] [ERROR] Sentry responded with an error: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128) (url: https://app.getsentry.com/api/90254/store/)
Traceback (most recent call last):
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/future/backports/urllib/request.py", line 494, in open
    response = self._open(req, data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/future/backports/urllib/request.py", line 512, in _open
    '_open', req)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/future/backports/urllib/request.py", line 466, in _call_chain
    result = func(*args)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/future/backports/urllib/request.py", line 1284, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "/usr/lib/python2.7/httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 895, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 1: ordinal not in range(128)
[2016-09-22 04:58:08] [sentry.errors.uncaught] [ERROR] [u"RuntimeError: Second simultaneous write on fileno 18 detected.  Unless you really know what you're doing, make sure that only one greenthread can write any particular socket.  Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.debug.hub_prevent_multiple_readers(False) - MY THREAD=<built-in method switch of greenlet.greenlet object at 0xb4972f30>; THAT THREAD=FdListener('write', 18, <built-in method switch of greenlet.greenlet object at 0xb4241530>, <built-in method throw of greenlet.greenlet object at 0xb4241530>)", u'  File "pokecli.py", line 843, in <module>', u'  File "pokecli.py", line 296, in main', u'  File "pokemongo_bot/event_manager.py", line 77, in emit', u'  File "pokemongo_bot/event_handlers/socketio_handler.py", line 28, in handle_event', u'  File "socketIO_client/__init__.py", line 429, in emit', u'  File "socketIO_client/__init__.py", line 28, in wrap', u'  File "socketIO_client/__init__.py", line 225, in _message', u'  File "socketIO_client/transports.py", line 162, in send_packet', u'  File "websocket/_core.py", line 239, in send', u'  File "websocket/_core.py", line 264, in send_frame', u'  File "websocket/_core.py", line 425, in _send', u'  File "websocket/_socket.py", line 112, in send', u'  File "eventlet/greenio/base.py", line 379, in send', u'  File "eventlet/greenio/base.py", line 374, in _send_loop', u'  File "eventlet/greenio/base.py", line 203, in _trampoline', u'  File "eventlet/hubs/__init__.py", line 160, in trampoline', u'  File "eventlet/hubs/epolls.py", line 49, in add', u'  File "eventlet/hubs/hub.py", line 177, in add']
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/__init__.py", line 203, in _close
    self._transport_instance.send_packet(engineIO_packet_type)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/transports.py", line 162, in send_packet
    self._connection.send(packet)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 239, in send
    return self.send_frame(frame)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 264, in send_frame
    l = self._send(data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 425, in _send
    return send(self.sock, data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_socket.py", line 112, in send
    return sock.send(data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 379, in send
    return self._send_loop(self.fd.send, data, flags)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 374, in _send_loop
    timeout_exc=socket.timeout("timed out"))
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 203, in _trampoline
    mark_as_closed=self._mark_as_closed)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/__init__.py", line 160, in trampoline
    listener = hub.add(hub.WRITE, fileno, current.switch, current.throw, mark_as_closed)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/epolls.py", line 49, in add
    listener = BaseHub.add(self, evtype, fileno, cb, tb, mac)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 177, in add
    evtype, fileno, evtype, cb, bucket[fileno]))
RuntimeError: Second simultaneous write on fileno 18 detected.  Unless you really know what you're doing, make sure that only one greenthread can write any particular socket.  Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.debug.hub_prevent_multiple_readers(False) - MY THREAD=<built-in method switch of greenlet.greenlet object at 0xb4972f30>; THAT THREAD=FdListener('write', 18, <built-in method switch of greenlet.greenlet object at 0xb4241530>, <built-in method throw of greenlet.greenlet object at 0xb4241530>)
Error in sys.exitfunc:
[2016-09-22 04:58:08] [sentry.errors.uncaught] [ERROR] [u"RuntimeError: Second simultaneous write on fileno 18 detected.  Unless you really know what you're doing, make sure that only one greenthread can write any particular socket.  Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.debug.hub_prevent_multiple_readers(False) - MY THREAD=<built-in method switch of greenlet.greenlet object at 0xb4972f30>; THAT THREAD=FdListener('write', 18, <built-in method switch of greenlet.greenlet object at 0xb4241530>, <built-in method throw of greenlet.greenlet object at 0xb4241530>)", u'  File "python2.7/atexit.py", line 24, in _run_exitfuncs', u'  File "socketIO_client/__init__.py", line 203, in _close', u'  File "socketIO_client/transports.py", line 162, in send_packet', u'  File "websocket/_core.py", line 239, in send', u'  File "websocket/_core.py", line 264, in send_frame', u'  File "websocket/_core.py", line 425, in _send', u'  File "websocket/_socket.py", line 112, in send', u'  File "eventlet/greenio/base.py", line 379, in send', u'  File "eventlet/greenio/base.py", line 374, in _send_loop', u'  File "eventlet/greenio/base.py", line 203, in _trampoline', u'  File "eventlet/hubs/__init__.py", line 160, in trampoline', u'  File "eventlet/hubs/epolls.py", line 49, in add', u'  File "eventlet/hubs/hub.py", line 177, in add']
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/__init__.py", line 203, in _close
    self._transport_instance.send_packet(engineIO_packet_type)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/socketIO_client/transports.py", line 162, in send_packet
    self._connection.send(packet)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 239, in send
    return self.send_frame(frame)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 264, in send_frame
    l = self._send(data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_core.py", line 425, in _send
    return send(self.sock, data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/websocket/_socket.py", line 112, in send
    return sock.send(data)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 379, in send
    return self._send_loop(self.fd.send, data, flags)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 374, in _send_loop
    timeout_exc=socket.timeout("timed out"))
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/greenio/base.py", line 203, in _trampoline
    mark_as_closed=self._mark_as_closed)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/__init__.py", line 160, in trampoline
    listener = hub.add(hub.WRITE, fileno, current.switch, current.throw, mark_as_closed)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/epolls.py", line 49, in add
    listener = BaseHub.add(self, evtype, fileno, cb, tb, mac)
  File "/root/mydata/pokemon-go-bots/python-bots/PokemonGo-Bot/env/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 177, in add
    evtype, fileno, evtype, cb, bucket[fileno]))
RuntimeError: Second simultaneous write on fileno 18 detected.  Unless you really know what you're doing, make sure that only one greenthread can write any particular socket.  Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.debug.hub_prevent_multiple_readers(False) - MY THREAD=<built-in method switch of greenlet.greenlet object at 0xb4972f30>; THAT THREAD=FdListener('write', 18, <built-in method switch of greenlet.greenlet object at 0xb4241530>, <built-in method throw of greenlet.greenlet object at 0xb4241530>)

Steps to Reproduce

Other Information

OS: Arch Linux ARM Branch: dev Git Commit: e12bae97a0e40a7c23805e1414c715f065799adc Python Version: 2.7.12

kureijir avatar Sep 22 '16 15:09 kureijir