FunctionInvocationWrapper.wrapped flag never resets when a function invocation throws
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- java
- Lĩnh vực
- observability
Hướng nghiên cứu
Bắt đầu trong SimpleFunctionRegistry.java tại SimpleFunctionRegistry.FunctionInvocationWrapper.apply(), đặc biệt là reset bao quanh doApply(). Theo dõi đường dẫn lỗi và tương tác với ObservationFunctionAroundWrapper. Hoàn thành khi các lần gọi bị lỗi lặp lại tiếp tục được quan sát và spring_cloud_function_seconds_count được tăng cho mỗi lỗi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug
In SimpleFunctionRegistry.FunctionInvocationWrapper.apply(), the FunctionInvocationWrapper.wrapped flag is set to true before delegating to doApply() (to prevent re-entrant wrapping). It is reset to false afterwards — but not in a finally block:
Object result = this.doApply(input, targetFunction);
targetFunction.wrapped = false; // ← skipped if doApply throws
return result;
When a function invocation throws, wrapped stays true forever. Every subsequent message finds wrapped = true and bypasses the ObservationFunctionAroundWrapper entirely.
This means ObservationFunctionAroundWrapper — and therefore the spring_cloud_function_seconds Micrometer timer — only records the very first message invocation which leads to an error. Every subsequent message bypasses the observation entirely.
Symptom
spring_cloud_function_seconds_count with an error is permanently stuck at 1 regardless of how many more messages result in an error. Confirmed with OTLP cumulative temporality (default), no pod restarts.
Expected behaviour
spring_cloud_function_seconds_count increments on every function invocation which leads to an error.
Actual behaviour
spring_cloud_function_seconds_count is always 1 after the first invocation which led to an error — further invocations are not observed.
Versions
spring-cloud-function-context:4.3.0- Also confirmed present in
mainbranch (same lines 622–623 inSimpleFunctionRegistry.java)
Suggested fix
Reset this.wrapped = false after the wrapper call returns, e.g. in a finally block:
this.wrapped = true;
try {
result = functionAroundWrapper.apply(input, this);
}
finally {
this.wrapped = false;
}
}
- Ngôn ngữ chính
- Java
- Star
- 1.1k
- Fork
- 641
- Merge trung bình
- 11 giờ 2 phút
- Pull request đã merge (30 ngày)
- 8
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của spring-cloud/spring-cloud-function
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
spring-cloud/spring-cloud-function#1455 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
spring-cloud/spring-cloud-function#1325 · 3 bình luận · 2 reaction ·
Tất cả issue của spring-cloud/spring-cloud-function
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
infinispan/infinispan#18150 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
opensearch-project/k-NN#3597 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100