8000 Ways to parse timestamp without TimestampSecondsWithFrac in gelf codec · Issue #23070 · vectordotdev/vector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ways to parse timestamp without TimestampSecondsWithFrac in gelf codec #23070

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

Open
wooffie opened this issue May 19, 2025 · 0 comments
Open

Ways to parse timestamp without TimestampSecondsWithFrac in gelf codec #23070

wooffie opened this issue May 19, 2025 · 0 comments
Labels
domain: codecs Anything related to Vector's codecs (encoding/decoding) type: bug A code related bug.

Comments

@wooffie
Copy link
Contributor
wooffie commented May 19, 2025

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

Using serde in lib/codecs/src/decoding/format/gelf.rs may cause panic.

Configuration


Version

latest

Debug Output

thread 'decoding::format::gelf::tests::gelf_deserializing_err' panicked at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chrono-0.4.41/src/datetime/mod.rs:1483:38:
`DateTime + TimeDelta` overflowed
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/std/src/panicking.rs:692:5
   1: core::panicking::panic_fmt
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_display
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/panicking.rs:261:5
   3: core::option::expect_failed
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/option.rs:2024:5
   4: core::option::Option<T>::expect
             at /home/wooffie/.rustup/toolchains/1.85-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:933:21
   5: <chrono::datetime::DateTime<Tz> as core::ops::arith::Add<chrono::time_delta::TimeDelta>>::add
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/chrono-0.4.41/src/datetime/mod.rs:1483:9
   6: serde_with::chrono_0_4::duration_to_datetime_utc
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_with-3.12.0/src/chrono_0_4.rs:443:8
   7: serde_with::chrono_0_4::<impl serde_with::de::DeserializeAs<chrono::datetime::DateTime<chrono::offset::utc::Utc>> for serde_with::TimestampSecondsWithFrac>::deserialize_as
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_with-3.12.0/src/chrono_0_4.rs:427:21
   8: <serde_with::de::impls::<impl serde_with::de::DeserializeAs<core::option::Option<T>> for core::option::Option<U>>::deserialize_as::OptionVisitor<T,U> as serde::de::Visitor>::visit_some
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_with-3.12.0/src/de/impls.rs:204:17
   9: <&mut serde_json::de::Deserializer<R> as serde::de::Deserializer>::deserialize_option
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_json-1.0.140/src/de.rs:1681:18
  10: serde_with::de::impls::<impl serde_with::de::DeserializeAs<core::option::Option<T>> for core::option::Option<U>>::deserialize_as
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_with-3.12.0/src/de/impls.rs:208:9
  11: serde_with::de::<impl serde_with::As<T>>::deserialize
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_with-3.12.0/src/de/mod.rs:158:9
  12: <<codecs::decoding::format::gelf::_::<impl serde::de::Deserialize for codecs::decoding::format::gelf::GelfMessage>::deserialize::__Visitor as serde::de::Visitor>::visit_map::__DeserializeWith as serde::de::Deserialize>::deserialize
             at ./src/decoding/format/gelf.rs:203:1
  13: <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde-1.0.219/src/de/mod.rs:800:9
  14: <serde_json::de::MapAccess<R> as serde::de::MapAccess>::next_value_seed
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_json-1.0.140/src/de.rs:2031:9
  15: serde::de::MapAccess::next_value
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde-1.0.219/src/de/mod.rs:1873:9
  16: <codecs::decoding::format::gelf::_::<impl serde::de::Deserialize for codecs::decoding::format::gelf::GelfMessage>::deserialize::__Visitor as serde::de::Visitor>::visit_map
             at ./src/decoding/format/gelf.rs:204:21
  17: <&mut serde_json::de::Deserializer<R> as serde::de::Deserializer>::deserialize_map
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_json-1.0.140/src/de.rs:1801:31
  18: codecs::decoding::format::gelf::_::<impl serde::de::Deserialize for codecs::decoding::format::gelf::GelfMessage>::deserialize
             at ./src/decoding/format/gelf.rs:204:21
  19: serde_json::de::from_trait
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_json-1.0.140/src/de.rs:2501:22
  20: serde_json::de::from_str
             at /home/wooffie/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/serde_json-1.0.140/src/de.rs:2701:5
  21: <codecs::decoding::format::gelf::GelfDeserializer as codecs::decoding::format::Deserializer>::parse
             at ./src/decoding/format/gelf.rs:227:21
  22: codecs::decoding::format::gelf::tests::deserialize_gelf_input
             at ./src/decoding/format/gelf.rs:253:9
  23: codecs::decoding::format::gelf::tests::gelf_deserializing_err::validate_err
             at ./src/decoding/format/gelf.rs:364:21
  24: codecs::decoding::format::gelf::tests::gelf_deserializing_err
             at ./src/decoding/format/gelf.rs:409:9
  25: codecs::decoding::format::gelf::tests::gelf_deserializing_err::{{closure}}
             at ./src/decoding/format/gelf.rs:362:32
  26: core::ops::function::FnOnce::call_once
             at /home/wooffie/.rustup/toolchains/1.85-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  27: core::ops::function::FnOnce::call_once
             at /rustc/4eb161250e340c8f48f66e2b929ef4a5bed7c181/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Example Data

validate_err(&json!({
HOST: "example.org",
SHORT_MESSAGE: "foobar",
VERSION: "1.1",
TIMESTAMP: 13850538621111.3072
}));

Additional Context

We using serde_as with predifined function, but this func returns results and unwrap error from checked_add, there is way for returning Option and create parse error in gelf.rs ?

References

No response

@wooffie wooffie added the type: bug A code related bug. label May 19, 2025
@pront pront added the domain: codecs Anything related to Vector's codecs (encoding/decoding) label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: codecs Anything related to Vector's codecs (encoding/decoding) type: bug A code related bug.
Projects
None yet
Development

No branches or pull requests

2 participants
0