HollowMan6/mdbook-pdf

PDF-generation fails: Panic following CapacityMessageTooLong

StefanSchroeder opened this issue · 1 comments

I am trying to build a moderately sized project with mdbook-pdf on NixOS.

with RUST_BACKTRACE=full the relevant output is:

Please advise.

2023-12-02 12:57:30 [INFO] (mdbook::book): Book building has started
2023-12-02 12:57:30 [INFO] (mdbook::book): Running the html backend
2023-12-02 12:57:32 [INFO] (mdbook::book): Running the pdf backend
2023-12-02 12:57:32 [INFO] (mdbook::renderer): Invoking the "pdf" renderer
Generating PDF, please be patient...
thread '<unnamed>' panicked at 'Unhandled WebSocket error for Chrome #Some(645181): Capacity(MessageTooLong { size: 80409288, max_size: 16777216 })', /build/mdbook-pdf-0.1.6-vendor.tar.gz/mdbook-pdf-headless_chrome/src/browser/transport/web_socket_connection.rs:100:25
stack backtrace:
   0:     0x55e8323255ba - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1792633461806265
   1:     0x55e83235ac0e - core::fmt::write::h86858dfe747be413
   2:     0x55e83233b5d5 - std::io::Write::write_fmt::h74e0842d6f1ebf1a
   3:     0x55e832325385 - std::sys_common::backtrace::print::h18201883e81727b4
   4:     0x55e83233bf5f - std::panicking::default_hook::{{closure}}::he7684422edfb8e5d
   5:     0x55e83233bc25 - std::panicking::default_hook::h0f55305c4c7e7f71
   6:     0x55e83233c428 - std::panicking::rust_panic_with_hook::hb89fb9ee5a2c564f
   7:     0x55e832326409 - std::panicking::begin_panic_handler::{{closure}}::hc641e1ce95f25c1f
   8:     0x55e8323256c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6a9bb70d00ab18d8
   9:     0x55e83233c112 - rust_begin_unwind
  10:     0x55e831edef63 - core::panicking::panic_fmt::h71a20a5609c5aabf
  11:     0x55e831fc2dd8 - headless_chrome::browser::transport::web_socket_connection::WebSocketConnection::dispatch_incoming_messages::h2ec5ef57572b63f7
  12:     0x55e831f65e7d - std::sys_common::backtrace::__rust_begin_short_backtrace::h918f316dc48f02d5
  13:     0x55e831fb467b - core::ops::function::FnOnce::call_once{{vtable.shim}}::h76b23a04f8a6964b
  14:     0x55e832329e33 - std::sys::unix::thread::Thread::new::thread_start::h4514580219a899c5
  15:     0x7f4ccd374e64 - start_thread
  16:     0x7f4ccd3f69f0 - __GI___clone3
  17:                0x0 - <unknown>
[2023-12-02T11:57:50Z ERROR headless_chrome::browser::transport] Transport loop got disconnected from WS's sender (Chrome #Some(645181))
thread 'main' panicked at 'Unable to make method calls because underlying connection is closed, so PDF generation failed!', src/main.rs:213:21
stack backtrace:
   0:     0x55e8323255ba - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1792633461806265
   1:     0x55e83235ac0e - core::fmt::write::h86858dfe747be413
   2:     0x55e83233b5d5 - std::io::Write::write_fmt::h74e0842d6f1ebf1a
   3:     0x55e832325385 - std::sys_common::backtrace::print::h18201883e81727b4
   4:     0x55e83233bf5f - std::panicking::default_hook::{{closure}}::he7684422edfb8e5d
   5:     0x55e83233bc25 - std::panicking::default_hook::h0f55305c4c7e7f71
   6:     0x55e83233c428 - std::panicking::rust_panic_with_hook::hb89fb9ee5a2c564f
   7:     0x55e832326409 - std::panicking::begin_panic_handler::{{closure}}::hc641e1ce95f25c1f
   8:     0x55e8323256c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6a9bb70d00ab18d8
   9:     0x55e83233c112 - rust_begin_unwind
  10:     0x55e831edef63 - core::panicking::panic_fmt::h71a20a5609c5aabf
  11:     0x55e831f17950 - mdbook_pdf::main::hbdf78c6b93722f4b
  12:     0x55e831f183b3 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd7b58311cc44141a
  13:     0x55e831ef6549 - std::rt::lang_start::{{closure}}::h9a2b98d02f1d6bc4
  14:     0x55e832330938 - std::rt::lang_start_internal::h34bd518f25d68bbe
  15:     0x55e831f181f5 - main
  16:     0x7f4ccd312b0e - __libc_start_call_main
  17:     0x7f4ccd312bc9 - __libc_start_main@@GLIBC_2.34
  18:     0x55e831edf4b5 - _start
  19:                0x0 - <unknown>
2023-12-02 12:57:50 [ERROR] (mdbook::renderer): Renderer exited with non-zero return code.
2023-12-02 12:57:50 [ERROR] (mdbook::utils): Error: Rendering failed
2023-12-02 12:57:50 [ERROR] (mdbook::utils): 	Caused By: The "pdf" renderer failed

This is actually an old issue that has already been fixed in #17 and I can see you are still using v0.1.6. Please use v0.1.7, the version has already been bumped in nixpkgs so I'm not sure why you are still using the old one: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/text/mdbook-pdf/default.nix

If you have any difficulties with that, check
#14 (comment)