firebase-admin-python: Messaging: Errors with multicast send
- App Engine environment
- firebase-admin: 4.4.0
- Firebase Product: Messaging
Describe the problem
From time to time, while sending multicast notification from our app engine application, the following issues are reported, all at the same time:
KeyError: '8'
at execute (/layers/google.python.pip/pip/googleapiclient/http.py:1548)
at positional_wrapper (/layers/google.python.pip/pip/googleapiclient/_helpers.py:134)
at send_all (/layers/google.python.pip/pip/firebase_admin/messaging.py:390)
at send_multicast (/layers/google.python.pip/pip/firebase_admin/messaging.py:167)
at send (/srv/main.py:109)
at notification_send (/srv/main.py:55)
at dispatch_request (/layers/google.python.pip/pip/flask/app.py:1936)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1950)
at reraise (/layers/google.python.pip/pip/flask/_compat.py:39)
at handle_user_exception (/layers/google.python.pip/pip/flask/app.py:1821)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1952)
at wsgi_app (/layers/google.python.pip/pip/flask/app.py:2447)
OSError: [Errno 0] Error
at read (/opt/python3.8/lib/python3.8/ssl.py:1099)
at recv_into (/opt/python3.8/lib/python3.8/ssl.py:1241)
at readinto (/opt/python3.8/lib/python3.8/socket.py:669)
at _read_status (/opt/python3.8/lib/python3.8/http/client.py:268)
at begin (/opt/python3.8/lib/python3.8/http/client.py:307)
at getresponse (/opt/python3.8/lib/python3.8/http/client.py:1347)
at _conn_request (/layers/google.python.pip/pip/httplib2/__init__.py:1589)
at _request (/layers/google.python.pip/pip/httplib2/__init__.py:1650)
at request (/layers/google.python.pip/pip/httplib2/__init__.py:1985)
at request (/layers/google.python.pip/pip/google_auth_httplib2.py:200)
at _execute (/layers/google.python.pip/pip/googleapiclient/http.py:1469)
at execute (/layers/google.python.pip/pip/googleapiclient/http.py:1540)
at positional_wrapper (/layers/google.python.pip/pip/googleapiclient/_helpers.py:134)
at send_all (/layers/google.python.pip/pip/firebase_admin/messaging.py:390)
at send_multicast (/layers/google.python.pip/pip/firebase_admin/messaging.py:167)
at send (/srv/main.py:109)
at notification_send (/srv/main.py:55)
at dispatch_request (/layers/google.python.pip/pip/flask/app.py:1936)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1950)
at reraise (/layers/google.python.pip/pip/flask/_compat.py:39)
at handle_user_exception (/layers/google.python.pip/pip/flask/app.py:1821)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1952)
at wsgi_app (/layers/google.python.pip/pip/flask/app.py:2447)
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:2622)
at read (/opt/python3.8/lib/python3.8/ssl.py:1099)
at recv_into (/opt/python3.8/lib/python3.8/ssl.py:1241)
at readinto (/opt/python3.8/lib/python3.8/socket.py:669)
at _safe_read (/opt/python3.8/lib/python3.8/http/client.py:612)
at _readall_chunked (/opt/python3.8/lib/python3.8/http/client.py:575)
at read (/opt/python3.8/lib/python3.8/http/client.py:465)
at _conn_request (/layers/google.python.pip/pip/httplib2/__init__.py:1618)
at _request (/layers/google.python.pip/pip/httplib2/__init__.py:1650)
at request (/layers/google.python.pip/pip/httplib2/__init__.py:1985)
at request (/layers/google.python.pip/pip/google_auth_httplib2.py:200)
at _execute (/layers/google.python.pip/pip/googleapiclient/http.py:1469)
at execute (/layers/google.python.pip/pip/googleapiclient/http.py:1540)
at positional_wrapper (/layers/google.python.pip/pip/googleapiclient/_helpers.py:134)
at send_all (/layers/google.python.pip/pip/firebase_admin/messaging.py:390)
at send_multicast (/layers/google.python.pip/pip/firebase_admin/messaging.py:167)
at send (/srv/main.py:109)
at notification_send (/srv/main.py:55)
at dispatch_request (/layers/google.python.pip/pip/flask/app.py:1936)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1950)
at reraise (/layers/google.python.pip/pip/flask/_compat.py:39)
at handle_user_exception (/layers/google.python.pip/pip/flask/app.py:1821)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1952)
at wsgi_app (/layers/google.python.pip/pip/flask/app.py:2447)
ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2622)
at read (/opt/python3.8/lib/python3.8/ssl.py:1099)
at recv_into (/opt/python3.8/lib/python3.8/ssl.py:1241)
at readinto (/opt/python3.8/lib/python3.8/socket.py:669)
at _read_status (/opt/python3.8/lib/python3.8/http/client.py:268)
at begin (/opt/python3.8/lib/python3.8/http/client.py:307)
at getresponse (/opt/python3.8/lib/python3.8/http/client.py:1347)
at _conn_request (/layers/google.python.pip/pip/httplib2/__init__.py:1589)
at _request (/layers/google.python.pip/pip/httplib2/__init__.py:1650)
at request (/layers/google.python.pip/pip/httplib2/__init__.py:1985)
at request (/layers/google.python.pip/pip/google_auth_httplib2.py:200)
at _execute (/layers/google.python.pip/pip/googleapiclient/http.py:1469)
at execute (/layers/google.python.pip/pip/googleapiclient/http.py:1540)
at positional_wrapper (/layers/google.python.pip/pip/googleapiclient/_helpers.py:134)
at send_all (/layers/google.python.pip/pip/firebase_admin/messaging.py:390)
at send_multicast (/layers/google.python.pip/pip/firebase_admin/messaging.py:167)
at send (/srv/main.py:109)
at notification_send (/srv/main.py:55)
at dispatch_request (/layers/google.python.pip/pip/flask/app.py:1936)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1950)
at reraise (/layers/google.python.pip/pip/flask/_compat.py:39)
at handle_user_exception (/layers/google.python.pip/pip/flask/app.py:1821)
at full_dispatch_request (/layers/google.python.pip/pip/flask/app.py:1952)
at wsgi_app (/layers/google.python.pip/pip/flask/app.py:2447)
Steps to reproduce:
message = messaging.MulticastMessage(apns=apnsConfig, tokens=tokens)
response = messaging.send_multicast(message)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 15 (5 by maintainers)
I think for most developers, putting the
send_multicast()
call behind a lock should be sufficient to avoid the multithreading issues.You can also try calling
send()
in a loop, but it would be a lot slower thansend_multicast()
.