Skip to content

exceptions.FirebaseError does not catch BrokenPipeError #506

@bitard-life

Description

@bitard-life

OS: Debian 10 (buster)
Python: Python 3.7.3
Library: firebase-admin 4.4.0
Product: messaging

Error:

Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "main.py", line 597, in thread_live
    response = messaging.send_multicast( message )
  File "/usr/local/lib/python3.7/dist-packages/firebase_admin/messaging.py", line 167, in send_multicast
    return _get_messaging_service(app).send_all(messages, dry_run)
  File "/usr/local/lib/python3.7/dist-packages/firebase_admin/messaging.py", line 390, in send_all
    batch.execute()
  File "/usr/local/lib/python3.7/dist-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/googleapiclient/http.py", line 1540, in execute
    self._execute(http, self._order, self._requests)
  File "/usr/local/lib/python3.7/dist-packages/googleapiclient/http.py", line 1470, in _execute
    self._batch_uri, method="POST", body=body, headers=headers
  File "/usr/local/lib/python3.7/dist-packages/google_auth_httplib2.py", line 201, in request
    uri, method, body=body, headers=request_headers, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/httplib2/__init__.py", line 1994, in request
    cachekey,
  File "/usr/local/lib/python3.7/dist-packages/httplib2/__init__.py", line 1651, in _request
    conn, request_uri, method, body, headers
  File "/usr/local/lib/python3.7/dist-packages/httplib2/__init__.py", line 1558, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "/usr/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1065, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/usr/lib/python3.7/ssl.py", line 1015, in sendall
    v = self.send(byte_view[count:])
  File "/usr/lib/python3.7/ssl.py", line 984, in send
    return self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe

Steps to reproduce:

The script was sending push notifications for a long time and suddenly an error appeared.

Code:

while True:
   try:
     response = messaging.send_multicast( message )
   except firebase_admin.exceptions.FirebaseError as ex:
     print( ex.message )

   sleep( 60 )

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions