realpython / realpython/materials

Sockets of multi connect server's client do not close on minor change from eco server to normal server and normal client

オープン
#241 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Jupyter Notebook
スター
5.2k
フォーク
5.3k
平均マージ
4日 10時間
マージ済み PR(30日)
10

説明

ℹ️
After I use it (https://github.com/realpython/materials/blob/master/python-sockets-tutorial/multiconn-client.py) with a small change (minor change from echo server to normal server) -

- after sending and receiving messages from the client and server, the client does not close; or
- all data.messages have been exausted, the client does not close.

https://stackoverflow.com/questions/70640602/sockets-in-python-client-not-closing-after-event-read-write-events-in-multi-conn

You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.

Describe the bug
After minor change from echo server to normal server:

- after sending and receiving messages from the client and server, the client does not close; or
- all data.messages have been exausted, the client does not close.

To Reproduce
Provided in the stackoverflow question

Expected behavior
The client should close. Looks like it does not get into the if not recv_data code while I was checking. The program should reach the code. No major changes to the code has been made other than sending data from messages section. :

if not recv_data:
    print("closing connection", data.connid)
    sel.unregister(sock)
    sock.close()

Screenshots
Added to link:
https://stackoverflow.com/questions/70640602/sockets-in-python-client-not-closing-after-event-read-write-events-in-multi-conn

Desktop (please complete the following information):

  • OS: [e.g. iOS] Win, Linux

Additional context
NA

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

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

python-sockets-tutorial/multiconn-client.py とリンク先の Stack Overflow の再現例から始め、echo-server の変更を、説明されている normal-server のフローと比較します。メッセージをすべて使い果たした後、クライアントが示されている if not recv_data 分岐に到達して終了することを確認します。完了とは、説明されている両方のケースでクライアントが確実に終了することです。

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

評価

技術スタック
python
領域
networking
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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