Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

WriteApi does not respect Ctrl+C / KeyboardInterrupt / SIGTERM

Đang mở
#688 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với điểm vào client.write_api() và cách sử dụng InfluxDBClient được thể hiện trong influxdb_client/client/influxdb_client.py. Tái hiện trường hợp không có máy chủ, sau đó theo dõi api.exit trong lúc Ctrl+C hoặc SIGTERM; được xem là hoàn tất khi quá trình tắt tạo ra KeyboardInterrupt ngay lập tức thay vì chờ các lần thử lại hoàn tất.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
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

Ngôn ngữ chính
Python
Star
792
Fork
186
Merge trung bình
3 giờ 2 phút
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của influxdata/influxdb-client-python

Tất cả issue của influxdata/influxdb-client-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.