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

fix!: remove error message from http header to avoid panic #3506

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

sunng87
Copy link
Member

@sunng87 sunng87 commented Mar 13, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

This patch removes GREPTIME_DB_HEADER_ERROR_MSG which tries to include error message in http header. Because the error message often contains characters that is invalid for http header, and the message size can also be too long for header.

Panic information:

2024-03-13T18:56:39.986929Z ERROR common_telemetry::panic_hook: panicked at greptimedb/src/servers/src/http/error_result.rs:88:41:
malformed error msg: InvalidHeaderValue backtrace=   0: common_telemetry::panic_hook::set_panic_hook::{{closure}}
             at home/runner/work/greptimedb-cloud/greptimedb-cloud/greptimedb/src/common/telemetry/src/panic_hook.rs:37:25
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/alloc/src/boxed.rs:2029:9
      std::panicking::rust_panic_with_hook
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/std/src/panicking.rs:783:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/std/src/panicking.rs:657:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/std/src/sys_common/backtrace.rs:171:18
   4: rust_begin_unwind
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/std/src/panicking.rs:645:5
   5: core::panicking::panic_fmt
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/core/src/panicking.rs:72:14
   6: core::result::unwrap_failed
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/core/src/result.rs:1649:5
   7: core::result::Result<T,E>::expect
             at rustc/3f28fe133475ec5faf3413b556bf3cfb0d51336c/library/core/src/result.rs:1030:23
      <servers::http::error_result::ErrorResponse as axum_core::response::into_response::IntoResponse>::into_response
             at home/runner/work/greptimedb-cloud/greptimedb-cloud/greptimedb/src/servers/src/http/error_result.rs:88:13
   8: <servers::http::HttpResponse as axum_core::response::into_response::IntoResponse>::into_response
             at home/runner/work/greptimedb-cloud/greptimedb-cloud/greptimedb/src/servers/src/http.rs:354:42
   9: <F as axum::handler::Handler<(M,T1,T2,T3,T4),S,B>>::call::{{closure}}
             at home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/axum-0.6.20/src/handler/mod.rs:250:21
  10: <core::pin::Pin<P> as core::future::future::Future>::poll

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

@sunng87 sunng87 requested review from tisonkun and shuiyisong March 13, 2024 21:28
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Mar 13, 2024
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.96%. Comparing base (e433396) to head (64dfea2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3506      +/-   ##
==========================================
- Coverage   85.34%   84.96%   -0.39%     
==========================================
  Files         904      904              
  Lines      150172   150172              
==========================================
- Hits       128169   127595     -574     
- Misses      22003    22577     +574     

@sunng87 sunng87 added the breaking-change This pull request contains breaking changes. label Mar 14, 2024
@github-actions github-actions bot removed the breaking-change This pull request contains breaking changes. label Mar 14, 2024
@sunng87 sunng87 changed the title fix: remove error message from http header to avoid panic fix!: remove error message from http header to avoid panic Mar 14, 2024
@github-actions github-actions bot added the breaking-change This pull request contains breaking changes. label Mar 14, 2024
@shuiyisong shuiyisong added this pull request to the merge queue Mar 14, 2024
Merged via the queue into GreptimeTeam:main with commit d334d74 Mar 14, 2024
29 checks passed
@shuiyisong shuiyisong deleted the fix/panic-on-error branch March 14, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This pull request contains breaking changes. docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants