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

hab-sup panics when pkg_export tries to export struct #5854

Closed
jaym opened this issue Nov 15, 2018 · 2 comments
Closed

hab-sup panics when pkg_export tries to export struct #5854

jaym opened this issue Nov 15, 2018 · 2 comments
Assignees
Labels
Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Bug Issues that describe broken functionality

Comments

@jaym
Copy link
Contributor

jaym commented Nov 15, 2018

This is ascii order dependent:

# default.toml
[service]
port=1111

[foo]
foo="foo"
bar="bar"
pkg_exports=(
[http-port]=service.port
[foo]=foo
)

does not work work

pkg_exports=(
[foo]=foo
[http-port]=service.port
)

does not work work

hab-sup dies with:

thread 'main' panicked at 'Struct should serialize to bytes: ValueAfterTable', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

================

The following works:

# default.toml
[service]
port=1111

[moo]
foo="foo"
bar="bar"
pkg_exports=(
[http-port]=service.port
[moo]=moo
)
pkg_exports=(
[moo]=moo
[http-port]=service.port
)
@baumanj baumanj added the E-easy label Dec 1, 2018
@christophermaier christophermaier added this to the 1.0 Supervisor milestone Dec 3, 2018
@jamesc jamesc self-assigned this Dec 5, 2018
@jamesc
Copy link

jamesc commented Dec 6, 2018

Full stacktrace on panic

stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:477
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:391
   6: rust_begin_unwind
             at libstd/panicking.rs:326
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::result::unwrap_failed
             at libcore/macros.rs:26
   9: <core::result::Result<T, E>>::expect
             at libcore/result.rs:835
  10: habitat_butterfly::rumor::service::Service::new::{{closure}}
             at ./components/butterfly/src/rumor/service.rs:116
  11: <core::option::Option<T>>::map
             at libcore/option.rs:414
  12: habitat_butterfly::rumor::service::Service::new
             at ./components/butterfly/src/rumor/service.rs:115
  13: habitat_sup::manager::service::Service::to_rumor
             at components/sup/src/manager/service/mod.rs:671
  14: habitat_sup::manager::Manager::gossip_latest_service_rumor
             at components/sup/src/manager/mod.rs:1473
  15: habitat_sup::manager::Manager::add_service
             at components/sup/src/manager/mod.rs:657
  16: habitat_sup::manager::Manager::start_initial_services_from_spec_watcher
             at components/sup/src/manager/mod.rs:1695
  17: habitat_sup::manager::Manager::run
             at components/sup/src/manager/mod.rs:697
  18: hab_sup::sub_run
             at components/sup/src/main.rs:190
  19: hab_sup::start
             at components/sup/src/main.rs:140
  20: hab_sup::main
             at components/sup/src/main.rs:84
  21: std::rt::lang_start::{{closure}}
             at libstd/rt.rs:74
  22: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  23: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:103
  24: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  25: std::rt::lang_start
             at libstd/rt.rs:74
  26: main
  27: __libc_start_main
  28: _start

Looks like @fnichol might have worried about this at time of writing: https://github.com/habitat-sh/habitat/blob/master/components/butterfly/src/rumor/service.rs#L113-L117

// TODO FN: Can we really expect this all the time, should we return a `Result<Self>`
 // in this constructor?
cfg: cfg
  .map(|v| toml::ser::to_vec(v).expect("Struct should serialize to bytes"))
                .unwrap_or_default(),

@jamesc
Copy link

jamesc commented Jan 11, 2019

Fixed by #5987

@jamesc jamesc closed this as completed Jan 11, 2019
@christophermaier christophermaier added Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Bug Issues that describe broken functionality and removed A-supervisor labels Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus:Supervisor Related to the Habitat Supervisor (core/hab-sup) component Type: Bug Issues that describe broken functionality
Projects
None yet
Development

No branches or pull requests

5 participants