scottlamb / moonfire-nvr

Moonfire NVR, a security camera network video recorder
Other
1.2k stars 138 forks source link

Schema upgrade fails with "empty host" #182

Closed AndrolGenhald closed 2 years ago

AndrolGenhald commented 2 years ago

When upgrading from schema version 6 to 7 it failed for me with an "empty host" error. I managed to work around the issue by downgrading to version 6, updating the config to put some random strings in the onvif host configuration for each camera, upgrading, and then removing the onvif host after it succeeded. Version 0.7.1 was used for both attempts.

I20211112 22:27:30.810 main moonfire_nvr::cmds] Opening /var/lib/moonfire-nvr/db/db in ReadWrite mode with SQLite version 3.31.1
I20211112 22:27:30.815 main moonfire_db::upgrade] ...database now in journal_mode delete (requested delete).
I20211112 22:27:30.815 main moonfire_db::upgrade] Upgrading database from version 6 to version 7...
I20211112 22:27:30.815 main moonfire_db::upgrade] ...from version 6 to version 7
E20211112 22:27:30.856 main moonfire_nvr] Exiting due to error: empty host

Backtrace:
   0: failure::backtrace::internal::InternalBacktrace::new
             at .cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.8/src/backtrace/internal.rs:46:44
   1: failure::backtrace::Backtrace::new
             at .cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.8/src/backtrace/mod.rs:121:35
      <failure::backtrace::Backtrace as core::default::Default>::default
             at .cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.8/src/backtrace/mod.rs:140:13
   2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from
             at .cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.8/src/error/error_impl.rs:19:17
      <failure::error::Error as core::convert::From<F>>::from
             at .cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.8/src/error/mod.rs:36:18
      <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/result.rs:1897:27
      moonfire_db::upgrade::v6_to_v7::copy_cameras
             at src/server/db/upgrade/v6_to_v7.rs:257:29
      moonfire_db::upgrade::v6_to_v7::run
             at src/server/db/upgrade/v6_to_v7.rs:441:5
   3: moonfire_db::upgrade::upgrade
             at src/server/db/upgrade/mod.rs:79:13
      moonfire_db::upgrade::run
             at src/server/db/upgrade/mod.rs:98:5
   4: moonfire_nvr::cmds::upgrade::run
             at src/server/src/cmds/upgrade/mod.rs:46:5
      moonfire_nvr::Args::run
             at src/server/src/main.rs:71:33
      moonfire_nvr::main
             at src/server/src/main.rs:143:9
   5: core::ops::function::FnOnce::call_once
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5
      std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/sys_common/backtrace.rs:125:18
   6: std::rt::lang_start::{{closure}}
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:63:18
   7: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:259:13
      std::panicking::try::do_call
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401:40
      std::panicking::try
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365:19
      std::panic::catch_unwind
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434:14
      std::rt::lang_start_internal::{{closure}}
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45:48
      std::panicking::try::do_call
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:401:40
      std::panicking::try
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:365:19
      std::panic::catch_unwind
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panic.rs:434:14
      std::rt::lang_start_internal
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/rt.rs:45:20
   8: main
   9: __libc_start_main
  10: _start
scottlamb commented 2 years ago

Thanks for reporting this, and I'm glad you were able to find a workaround. I'll get a fix into the next release. It might be a little bit because I'm knee deep in code lower in the stack than Moonfire NVR right now.