eiffel-community / eiffel-community/eiffel-pythonlib

Occasional AssertionError exception

オープン
#25 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
8
フォーク
12
PR マージ指標
30日以内にマージされた PR はありません

説明

### 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

eiffellib/lib/base_rabbitmq.py の keep_alive と run の周辺を調査し、公開および確認のフローを pika issue 1219 と比較してください。利用可能な debug レベルのログを使ってタイミングを調査し、両方の送信メッセージで AssertionError を再現してください。例外とメッセージの喪失が発生しなくなれば完了とし、動作を再現できる場合はリグレッションテストを追加してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, rabbitmq
領域
backend, distributed-systems
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。