aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2025-03-07 04:36:41 +0000
committerAlexander Smirnov <alex@ydb.tech>2025-03-07 04:36:41 +0000
commit653965ad78c6f5040998795f6491609c3f5639d3 (patch)
treed930c9399df0c6661bd0df1a4533571794d0b5c8 /contrib
parent26e405b19a83b1c4b897def9729ddaa03c5b3e50 (diff)
parentf105ca152f8c1730d895e952fee6a08eba5b5a03 (diff)
downloadydb-653965ad78c6f5040998795f6491609c3f5639d3.tar.gz
Merge pull request #15443 from ydb-platform/merge-libs-250307-0050
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libs/grpc/patches/pr38881_rst_stream.patch17
-rw-r--r--contrib/libs/grpc/patches/pr38907_fix_race_condition_in_perAttemptRecvTimeout_timer.patch55
-rw-r--r--contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc46
-rw-r--r--contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc8
-rw-r--r--contrib/libs/libunwind/patches/04-wasm-exceptions.patch8
-rw-r--r--contrib/libs/libunwind/src/Unwind-wasm.c6
6 files changed, 114 insertions, 26 deletions
diff --git a/contrib/libs/grpc/patches/pr38881_rst_stream.patch b/contrib/libs/grpc/patches/pr38881_rst_stream.patch
new file mode 100644
index 00000000000..69ff5330997
--- /dev/null
+++ b/contrib/libs/grpc/patches/pr38881_rst_stream.patch
@@ -0,0 +1,17 @@
+--- contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc (8f4736fcb2c85a5a7647b2ed61a82fb96e3f9363)
++++ contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc (working tree)
+@@ -2076,9 +2076,11 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ grpc_http2_error_code http_error;
+ grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
+ &http_error, nullptr);
+- grpc_chttp2_add_rst_stream_to_next_write(
+- t, s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing);
+- grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
++ if (s->sent_initial_metadata) {
++ grpc_chttp2_add_rst_stream_to_next_write(
++ t, s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing);
++ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
++ }
+ }
+ }
+ if (!due_to_error.ok() && !s->seen_error) {
diff --git a/contrib/libs/grpc/patches/pr38907_fix_race_condition_in_perAttemptRecvTimeout_timer.patch b/contrib/libs/grpc/patches/pr38907_fix_race_condition_in_perAttemptRecvTimeout_timer.patch
new file mode 100644
index 00000000000..705258089c2
--- /dev/null
+++ b/contrib/libs/grpc/patches/pr38907_fix_race_condition_in_perAttemptRecvTimeout_timer.patch
@@ -0,0 +1,55 @@
+--- contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc (275a6f99de0655569f20495a7c5683e0b5e06c8d)
++++ contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc (working tree)
+@@ -1265,28 +1265,30 @@ void RetryFilter::CallData::CallAttempt::OnPerAttemptRecvTimerLocked(
+ call_attempt->per_attempt_recv_timer_handle_.has_value());
+ }
+ CallCombinerClosureList closures;
+- call_attempt->per_attempt_recv_timer_handle_.reset();
+- // Cancel this attempt.
+- // TODO(roth): When implementing hedging, we should not cancel the
+- // current attempt.
+- call_attempt->MaybeAddBatchForCancelOp(
+- grpc_error_set_int(
+- GRPC_ERROR_CREATE("retry perAttemptRecvTimeout exceeded"),
+- StatusIntProperty::kRpcStatus, GRPC_STATUS_CANCELLED),
+- &closures);
+- // Check whether we should retry.
+- if (call_attempt->ShouldRetry(/*status=*/y_absl::nullopt,
+- /*server_pushback_ms=*/y_absl::nullopt)) {
+- // Mark current attempt as abandoned.
+- call_attempt->Abandon();
+- // We are retrying. Start backoff timer.
+- calld->StartRetryTimer(/*server_pushback=*/y_absl::nullopt);
+- } else {
+- // Not retrying, so commit the call.
+- calld->RetryCommit(call_attempt);
+- // If retry state is no longer needed, switch to fast path for
+- // subsequent batches.
+- call_attempt->MaybeSwitchToFastPath();
++ if (call_attempt->per_attempt_recv_timer_handle_.has_value()) {
++ call_attempt->per_attempt_recv_timer_handle_.reset();
++ // Cancel this attempt.
++ // TODO(roth): When implementing hedging, we should not cancel the
++ // current attempt.
++ call_attempt->MaybeAddBatchForCancelOp(
++ grpc_error_set_int(
++ GRPC_ERROR_CREATE("retry perAttemptRecvTimeout exceeded"),
++ StatusIntProperty::kRpcStatus, GRPC_STATUS_CANCELLED),
++ &closures);
++ // Check whether we should retry.
++ if (call_attempt->ShouldRetry(/*status=*/y_absl::nullopt,
++ /*server_pushback_ms=*/y_absl::nullopt)) {
++ // Mark current attempt as abandoned.
++ call_attempt->Abandon();
++ // We are retrying. Start backoff timer.
++ calld->StartRetryTimer(/*server_pushback=*/y_absl::nullopt);
++ } else {
++ // Not retrying, so commit the call.
++ calld->RetryCommit(call_attempt);
++ // If retry state is no longer needed, switch to fast path for
++ // subsequent batches.
++ call_attempt->MaybeSwitchToFastPath();
++ }
+ }
+ closures.RunClosures(calld->call_combiner_);
+ call_attempt->Unref(DEBUG_LOCATION, "OnPerAttemptRecvTimer");
diff --git a/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc b/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc
index e92398f4b21..3cb930b8167 100644
--- a/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc
+++ b/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc
@@ -1265,28 +1265,30 @@ void RetryFilter::CallData::CallAttempt::OnPerAttemptRecvTimerLocked(
call_attempt->per_attempt_recv_timer_handle_.has_value());
}
CallCombinerClosureList closures;
- call_attempt->per_attempt_recv_timer_handle_.reset();
- // Cancel this attempt.
- // TODO(roth): When implementing hedging, we should not cancel the
- // current attempt.
- call_attempt->MaybeAddBatchForCancelOp(
- grpc_error_set_int(
- GRPC_ERROR_CREATE("retry perAttemptRecvTimeout exceeded"),
- StatusIntProperty::kRpcStatus, GRPC_STATUS_CANCELLED),
- &closures);
- // Check whether we should retry.
- if (call_attempt->ShouldRetry(/*status=*/y_absl::nullopt,
- /*server_pushback_ms=*/y_absl::nullopt)) {
- // Mark current attempt as abandoned.
- call_attempt->Abandon();
- // We are retrying. Start backoff timer.
- calld->StartRetryTimer(/*server_pushback=*/y_absl::nullopt);
- } else {
- // Not retrying, so commit the call.
- calld->RetryCommit(call_attempt);
- // If retry state is no longer needed, switch to fast path for
- // subsequent batches.
- call_attempt->MaybeSwitchToFastPath();
+ if (call_attempt->per_attempt_recv_timer_handle_.has_value()) {
+ call_attempt->per_attempt_recv_timer_handle_.reset();
+ // Cancel this attempt.
+ // TODO(roth): When implementing hedging, we should not cancel the
+ // current attempt.
+ call_attempt->MaybeAddBatchForCancelOp(
+ grpc_error_set_int(
+ GRPC_ERROR_CREATE("retry perAttemptRecvTimeout exceeded"),
+ StatusIntProperty::kRpcStatus, GRPC_STATUS_CANCELLED),
+ &closures);
+ // Check whether we should retry.
+ if (call_attempt->ShouldRetry(/*status=*/y_absl::nullopt,
+ /*server_pushback_ms=*/y_absl::nullopt)) {
+ // Mark current attempt as abandoned.
+ call_attempt->Abandon();
+ // We are retrying. Start backoff timer.
+ calld->StartRetryTimer(/*server_pushback=*/y_absl::nullopt);
+ } else {
+ // Not retrying, so commit the call.
+ calld->RetryCommit(call_attempt);
+ // If retry state is no longer needed, switch to fast path for
+ // subsequent batches.
+ call_attempt->MaybeSwitchToFastPath();
+ }
}
closures.RunClosures(calld->call_combiner_);
call_attempt->Unref(DEBUG_LOCATION, "OnPerAttemptRecvTimer");
diff --git a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index 7910d42fffa..07491d7bc63 100644
--- a/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/contrib/libs/grpc/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -2076,9 +2076,11 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_http2_error_code http_error;
grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
&http_error, nullptr);
- grpc_chttp2_add_rst_stream_to_next_write(
- t, s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing);
- grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
+ if (s->sent_initial_metadata) {
+ grpc_chttp2_add_rst_stream_to_next_write(
+ t, s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
+ }
}
}
if (!due_to_error.ok() && !s->seen_error) {
diff --git a/contrib/libs/libunwind/patches/04-wasm-exceptions.patch b/contrib/libs/libunwind/patches/04-wasm-exceptions.patch
index 167b0a5d783..969f8c32835 100644
--- a/contrib/libs/libunwind/patches/04-wasm-exceptions.patch
+++ b/contrib/libs/libunwind/patches/04-wasm-exceptions.patch
@@ -12,7 +12,7 @@
#include <threads.h>
_Unwind_Reason_Code __gxx_personality_wasm0(int version, _Unwind_Action actions,
-@@ -120,4 +121,12 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context __attribute__((unused)))
+@@ -120,4 +121,18 @@ _Unwind_GetRegionStart(struct _Unwind_Context *context __attribute__((unused)))
return 0;
}
@@ -24,4 +24,10 @@
+_Unwind_RaiseException(_Unwind_Exception *exception_object __attribute__((unused))) {
+ abort();
+}
++
++#if !defined(NDEBUG) && defined(STANDALONE_WASM)
++void __throw_exception_with_stack_trace(_Unwind_Exception* ex) {
++ _Unwind_RaiseException(ex);
++}
++#endif
#endif // defined(__WASM_EXCEPTIONS__)
diff --git a/contrib/libs/libunwind/src/Unwind-wasm.c b/contrib/libs/libunwind/src/Unwind-wasm.c
index f1fa0fd25f0..0442a206e6b 100644
--- a/contrib/libs/libunwind/src/Unwind-wasm.c
+++ b/contrib/libs/libunwind/src/Unwind-wasm.c
@@ -129,4 +129,10 @@ _LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_RaiseException(_Unwind_Exception *exception_object __attribute__((unused))) {
abort();
}
+
+#if !defined(NDEBUG) && defined(STANDALONE_WASM)
+void __throw_exception_with_stack_trace(_Unwind_Exception* ex) {
+ _Unwind_RaiseException(ex);
+}
+#endif
#endif // defined(__WASM_EXCEPTIONS__)