The retry of a failed PUT hides the first answer from the caller

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

Maintainer thường phản hồi trong vòng 1 ngày

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
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api, backend

Hướng nghiên cứu

Start by tracing _post_put and how it handles failed PUT responses, then read the complete(handle_rrule=True) safe-mode path and the test added during review of PR #845. Compare the first and retry errors, including the vobject ParseError case; done means a failed save preserves enough of the first response for callers to handle possible storage correctly, with tests covering the reported cases.

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

Mô tả

Disclaimer: AI-generated text below the line, generated by Claude Opus 5.5, from the prompt:

Deal with PR #845 [https://github.com/python-caldav/caldav/pull/845; this issue came out of the review of that PR]


_post_put retries a failed PUT once when vobject is installed, a 5xx included. Only the error from the last attempt reaches the caller, so the caller cannot tell that the first attempt may have stored the object.

This matters for complete(handle_rrule=True) in the "safe" mode since https://github.com/python-caldav/caldav/pull/845. It keeps the completed copy after a 5xx on the recurring task, because the task may have been stored. But if the first PUT stores the task and answers 500, and the retry then gets a 412 (the old If-Match no longer matches) or a 403, the error looks like a refusal. The copy is deleted, the completion record is lost and the occurrence is skipped. This was reproduced with a fake client. It only happens with vobject installed, and vobject is only in the test extra.

Also, if the server refuses with e.g. a 403 and get_vobject_instance() then raises a vobject ParseError on data icalendar accepted, that ParseError replaces the server's error.

Possible fixes:

  • Drop the retry on 5xx. The comment says accessing vobject_instance may "clean" the object (https://github.com/python-caldav/caldav/issues/43), but get_vobject_instance() now returns a copy, and the body of the retry was byte-identical in the runs made for the review. This affects every save, so it needs checking.
  • Or raise the error of the first attempt, or carry its status on the error raised.
Ngôn ngữ chính
Python
Star
412
Fork
113
Merge trung bình
9 giờ 21 phút
Pull request đã merge (30 ngày)
77

Chuẩn bị môi trường

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 python-caldav/caldav

Tất cả issue của python-caldav/caldav

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.