The sound distributed version control system

#531 [BUG] Crash when attempting to record

Closed on December 7, 2021
verticalegg on September 12, 2021

Just installed Pijul, then pulled it from this repo and reinstalled to make sure I had the latest version. I created my own repository, but every time I try to record Pijul crashes. I’ve included the latest report here.

name = 'pijul'
operating_system = 'unix:Arch'
crate_version = '1.0.0-alpha.54'
explanation = '''
Panic occurred in file '/rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/slice/mod.rs' at line 3058
'''
cause = 'source slice length (4) does not match destination slice length (3)'
method = 'Panic'
backtrace = '''

   0: 0x557ba37b8972 - core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail::h52fe81156d22bea6
                at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/slice/mod.rs:3051
   1: 0x557ba3e0258c - zstd_seekable::compress::framelog::FrameLog::write_seek_table::hbfef5c736cc00dbc
   2: 0x557ba3e021a8 - zstd_seekable::compress::SeekableCStream::end_stream::ha3af8d5709801423
   3: 0x557ba3cb3eeb - libpijul::change::compress::hecd20c4ed8445879
   4: 0x557ba3cb4aef - libpijul::change::LocalChange<libpijul::change::Hunk<core::option::Option<libpijul::pristine::hash::Hash>,libpijul::change::Local>,libpijul::change::Author>::serialize::h659aa7c58300eccd
   5: 0x557ba3cef793 - <libpijul::changestore::filesystem::FileSystem as libpijul::changestore::ChangeStore>::save_change::he6c18cb9e63e3fb4
   6: 0x557ba3818539 - pijul::commands::record::Record::record::h1f16c3402cd12ad8
   7: 0x557ba3814db0 - pijul::commands::record::Record::run::h0b6f530b6ed004c4
   8: 0x557ba3a6c466 - pijul::run::{{closure}}::ha19d94907f38f5eb
   9: 0x557ba3a38e39 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h753f2fe949253b57
  10: 0x557ba397d329 - tokio::runtime::thread_pool::ThreadPool::block_on::ha2ce70c01ef6d8b8
  11: 0x557ba384c330 - tokio::runtime::Runtime::block_on::ha191203cdda0264f
  12: 0x557ba39c45ba - pijul::main::h12f03b717c8774ea
  13: 0x557ba383a213 - std::sys_common::backtrace::__rust_begin_short_backtrace::h7e3c0133b0184537
  14: 0x557ba3a05049 - std::rt::lang_start::{{closure}}::h52d77767875e4d48
  15: 0x557ba3fa9f09 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h2aabc384aab89b7b
                at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:259
                 - std::panicking::try::do_call::hc5fcacb7a85fc7b1
                at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:401
                 - std::panicking::try::hb5d9603af3abbe3a
                at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:365
                 - std::panic::catch_unwind::h98fe6ac3925e64b4
                at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panic.rs:434
                 - std::rt::lang_start_internal::h22ac7383c516f93e
                at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/rt.rs:34
  16: 0x557ba39c46d2 - main
  17: 0x7f954b2ecb25 - __libc_start_main
  18: 0x557ba37b8e3e - _start
  19:        0x0 - <unresolved>'''
pmeunier on September 12, 2021

Thanks for the report! This is due to the recent “oxidisation” of zstd-seekable, done by @darleybarreto. More debugging will tell whether this was already present in the original C version or not.

pmeunier on September 12, 2021

I can’t reproduce, would you mind sending a tarball of your repository to pe@pijul.org? Thanks.

potocpav on September 12, 2021

I bumped into the same issue while trying to record my changes for #530 on top of main. I had to use an older pijul instead of main (pijul v1.0.0-alpha.54). So that is a reproduction.

But I’m unable to push the changes. Is this the correct command?

$ pijul push https://nest.pijul.com/pijul/pijul --to-channel :530
Uploading changes [==================================================] 1/1

It seems successful, but the changes aren’t visible in Discussions.

EDIT: uploading over ssh worked. This patch can’t be recorded by the main version of pijul.

verticalegg on September 12, 2021

Just sent the tarball over.

potocpav on September 16, 2021

This is resolved for my test-cases. zstd is very slow now (both 1.5.0, and 1.4.9 on my Manjaro), but that is probably a separate issue.

darleybarreto on September 28, 2021

@potocpav Was the issue solved when you updated the zstd?

potocpav on September 29, 2021

@darleybarreto On pijul main, zstd 1.5.0-1, everything is still sloooow. Reproduction (on mobile, didn’t test):

git clone https://github.com/vim/vim.git
cd vim
pijul git .
# first commit takes at least 10s of minutes
# `flamegraph` reports ~95% of time in zstd
darleybarreto on October 9, 2021

@potocpav I ran those commands and this process take a while indeed :/

darleybarreto on October 9, 2021

@verticalegg could you kindly test pijul main to see if this bug was fixed?

pmeunier on October 9, 2021

I already noticed that I was writing the files twice, and changed the interface of save_change to reduce that overhead. The next improvement could be to change zstd-seekable to pinpoint a version of Zstd that is guaranteed to work with known compilation options. Since Zstd has 0 external dependencies (AFAIK), this is probably not going to be too hard (build.rs + the cc crate).

pmeunier on December 7, 2021

I can’t reproduce, and since these things changed, I believe the issue is fixed. Feel free to reopen if not.

pmeunier closed this discussion on December 7, 2021