influxdata / influxdata/influxdb-client-python

WriteApi does not respect Ctrl+C / KeyboardInterrupt / SIGTERM

Ouverte
#688 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug
Langage dominant
Python
Étoiles
793
Forks
186
Merge moyen
3 h 2 min
PR mergées (30 j)
1

Description

### Specifications

* Client Version: 1.48.0
* InfluxDB Version: 2.4.0
* Platform: Ubuntu 24.04

### Code sample to reproduce problem

1. Make sure there is no server running at the address below.
2. Run the following program
```python
import urllib3
from influxdb_client.client.influxdb_client import InfluxDBClient
from influxdb_client.client.write.point import Point

_RETRIES = urllib3.util.Retry(total=6, backoff_factor=0.8)
p = Point("dsjfsfd")
with InfluxDBClient("http://127.0.0.1:8086", org="fake", retries=_RETRIES) as client:
with client.write_api() as api:
api.write("mybucket", client.org, p)

```
3. Wait a second or two to make sure at least one attempt has been made.
4. Press **Ctrl+C** (or send a `SIGTERM` through some other mechanism, eg `kill` utility on linux)

### Expected behavior

`api.__exit__` should raise a `KeyboardInterrupt` exception immediately.

### Actual behavior

Program is stuck running for several minutes inside `api.__exit__`. Until program is force killed using `SIGKILL` or all retries have been exhausted.

### Additional info

I've also experimented with `write_options=WriteOptions(max_close_wait=1000)` but it does not help and it has the risk to affect the normal flow when user is not pressing Ctrl+C

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Start with the client.write_api() entry point and the InfluxDBClient usage shown in influxdb_client/client/influxdb_client.py. Reproduce the no-server case, then trace api.__exit__ during Ctrl+C or SIGTERM; done means shutdown raises KeyboardInterrupt promptly instead of waiting for retries to finish.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
api
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.