Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WriteApi does not respect Ctrl+C / KeyboardInterrupt / SIGTERM #688

Open
hterik opened this issue Mar 1, 2025 · 0 comments
Open

WriteApi does not respect Ctrl+C / KeyboardInterrupt / SIGTERM #688

hterik opened this issue Mar 1, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@hterik
Copy link

hterik commented Mar 1, 2025

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
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)
  1. Wait a second or two to make sure at least one attempt has been made.
  2. 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

@hterik hterik added the bug Something isn't working label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant