eiffel-community / eiffel-community/eiffel-pythonlib

Occasional AssertionError exception

Offen
#25 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
8
Forks
12
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Description
I stumbled upon the following exception with eiffel-pythonlib 1.1.0:

```
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/username/.pyenv/versions/3.6.9/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/username/.pyenv/versions/3.6.9/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/eiffellib/lib/base_rabbitmq.py", line 183, in keep_alive
self.run()
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/eiffellib/lib/base_rabbitmq.py", line 173, in run
self._connection.ioloop.start()
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/adapters/select_connection.py", line 543, in start
self._poller.start()
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/adapters/select_connection.py", line 803, in start
self.poll()
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/adapters/select_connection.py", line 1200, in poll
self._dispatch_fd_events(fd_event_map)
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/adapters/select_connection.py", line 904, in _dispatch_fd_events
handler(fileno, events)
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/adapters/utils/selector_ioloop_adapter.py", line 391, in _on_reader_writer_fd_events
callbacks.writer()
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/diagnostic_utils.py", line 53, in log_exception_func_wrap
return func(*args, **kwargs)
File "/home/username/src/programname/.tox/py36/lib/python3.6/site-packages/pika/adapters/utils/io_services_utils.py", line 1093, in _on_socket_writable
'but _tx_buffers is empty.', self._state)
AssertionError: ('_AsyncPlaintextTransport._on_socket_writable() called, but _tx_buffers is empty.', 1)
```

The program in question had consumed one messages and was about to publish two messages in response, but only one message ended up in the receiving queue and the consumed message was acked.

This happened when I was trying a new version of a program using eiffel-pythonlib and I couldn't see any similar cases in the production logs for the same program. Perhaps different timing since I was connecting to a RabbitMQ server on localhost? I have debug-level logs available if that would help.

https://github.com/pika/pika/issues/1219 indicates that this is a usage bug but I haven't dug into the eiffel-pythonlib to confirm this.

### Motivation
Exceptions like this shouldn't occur and messages should not be lost.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Untersuche eiffellib/lib/base_rabbitmq.py im Umfeld von keep_alive und run und vergleiche anschließend den Ablauf des Veröffentlichens und der Bestätigungen mit pika issue 1219. Nutze die verfügbaren Logs auf Debug-Level, um das Timing zu untersuchen, und reproduziere den AssertionError mit beiden ausgehenden Nachrichten; als erledigt gilt die Aufgabe, wenn die Exception und der Nachrichtenverlust nicht mehr auftreten, mit einem Regressionstest, falls sich das Verhalten reproduzieren lässt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, rabbitmq
Bereich
backend, distributed-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.