Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

TCP connection not closing properly leading to dangling CLOSE_WAIT state and system overload

Aperta
#471 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python, sql

Direzione di ricerca

Riproduci entrambi i casi usando Python 3.10.15, databricks-sql-python 3.1.2, le chiamate sql.connect mostrate e netstat per osservare gli stati dei socket. L’attività è completata quando le connessioni si chiudono correttamente dopo il context manager o le chiamate esplicite a close, non rimane alcun socket CLOSE_WAIT trattenuto indefinitamente e le risorse del client vengono liberate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Testcase 1

Python 3.10.15 (main, Sep  7 2024, 18:35:33) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from databricks import sql
>>> sql.__version__
'3.1.2'
>>> with sql.connect(server_hostname = "<HIDE>", http_path = "<HIDE>", access_token = "<HIDE>") as connection:
...     with connection.cursor() as cursor:
...             cursor.execute("select * from table")
...             column_names = [desc[0] for desc in cursor.description]
...             query_out = [dict(zip(column_names, row)) for row in cursor.fetchall()]
...             
... 
<databricks.sql.client.Cursor object at 0x7f88551c14e0>
>>> query_out
[{"sometime" : "something}]


On the sidelines, the network connection for this process (after with clause gets finished), remain in ESTABLISHED state and then moves to CLOSE_WAIT state indefinitely. 

Every 1.0s: netstat -apn | grep 1070099                                                                                          asinha-vm-ubuntu-20-04-1: Wed Nov 20 02:43:13 2024

tcp       25      0 10.5.220.4:58078        so:me:ip:add:443      CLOSE_WAIT  1070099/python3

Testcase 2

Python 3.10.15 (main, Sep  7 2024, 18:35:33) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from databricks import sql
>>> sql.__version__
'3.1.2'
>>> connection = sql.connect(server_hostname = "<HIDE>", http_path = "<HIDE>", access_token = "<HIDE>")
>>> ## at this point a TCP connection got made as ESTABLISHED state ##
>>> cursor = connection.cursor()
>>> cursor.execute("select * from table")
<databricks.sql.client.Cursor object at 0x7f9d65db26b0>
>>> column_names = [desc[0] for desc in cursor.description]
>>> query_out = [dict(zip(column_names, row)) for row in cursor.fetchall()]
>>> cursor.close()
>>> connection.close()
>>> # even after close being called, the connection remains in ESTABLISHED state (for a long time) and then finally moves to CLOSE_WAIT state, which never changes.

Every 1.0s: netstat -apn | grep 1074808                                                                                          asinha-vm-ubuntu-20-04-1: Wed Nov 20 02:49:36 2024

tcp       25      0 10.5.220.4:53810        so:me:ip:add:443      CLOSE_WAIT  1074808/python3

Connections should be closed properly, and all client resources should be freed properly.

Lingua principale
Python
Stelle
233
Fork
152
Merge medio
21h 5m
PR unite (30g)
10

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di databricks/databricks-sql-python

Tutte le issue di databricks/databricks-sql-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.