Pr0Ger / PyAPNs2

Python library for interacting with the Apple Push Notification service (APNs) via HTTP/2 protocol
MIT License
349 stars 179 forks source link

greenlet.error: cannot switch to a different thread #71

Closed ninwjf closed 5 years ago

ninwjf commented 6 years ago

An error occurs if the heartbeat_period parameter is set:

File "/home/web/.py3env/lib/python3.6/site-packages/apns2-0.4.1-py3.6.egg/apns2/client.py", line 179, in send_notification_batch result = self.get_notification_result(pending_stream.stream_id) File "/home/web/.py3env/lib/python3.6/site-packages/apns2-0.4.1-py3.6.egg/apns2/client.py", line 122, in get_notification_result with self._connection.get_response(stream_id) as response: File "/home/web/.py3env/lib/python3.6/site-packages/hyper/http20/connection.py", line 312, in get_response return HTTP20Response(stream.getheaders(), stream) File "/home/web/.py3env/lib/python3.6/site-packages/hyper/http20/stream.py", line 230, in getheaders self._recv_cb(stream_id=self.stream_id) File "/home/web/.py3env/lib/python3.6/site-packages/hyper/http20/connection.py", line 771, in _recv_cb self._single_read() File "/home/web/.py3env/lib/python3.6/site-packages/hyper/http20/connection.py", line 665, in _single_read self._sock.fill() File "/home/web/.py3env/lib/python3.6/site-packages/hyper/common/bufsocket.py", line 167, in fill count = self._sck.recv_into(self._buffer_view[self._buffer_end:]) File "/home/web/.py3env/lib/python3.6/site-packages/gevent/_ssl3.py", line 503, in recv_into return self.read(nbytes, buffer) File "/home/web/.py3env/lib/python3.6/site-packages/gevent/_ssl3.py", line 332, in read self._wait(self._read_event, timeout_exc=_SSLErrorReadTimeout) File "src/gevent/_hub_primitives.py", line 265, in gevent.__hub_primitives.wait_on_socket

File "src/gevent/_hub_primitives.py", line 266, in gevent.__hub_primitives.wait_on_socket

File "src/gevent/_hub_primitives.py", line 252, in gevent.__hub_primitives._primitive_wait

File "src/gevent/_hub_primitives.py", line 46, in gevent.__hub_primitives.WaitOperationsGreenlet.wait

File "src/gevent/_hub_primitives.py", line 46, in gevent.__hub_primitives.WaitOperationsGreenlet.wait

File "src/gevent/_hub_primitives.py", line 55, in gevent.__hub_primitives.WaitOperationsGreenlet.wait

File "src/gevent/_waiter.py", line 151, in gevent.__waiter.Waiter.get

File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch

File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch

File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch

File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch

greenlet.error: cannot switch to a different thread