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

Panic in fill_containers.rs:115 when indexing URL in markdown content #230

Closed
deining opened this issue Jan 3, 2022 · 5 comments
Closed
Assignees

Comments

@deining
Copy link

deining commented Jan 3, 2022

Thanks for resolving #227, I can confirm the fix resolves the issue reported by me yesterday.

However, I still cannot successfully generate the index: when trying to index another markdown-file, stork is crashing again during index generation:

Stacktrace:

    Finished dev [unoptimized + debuginfo] target(s) in 0.40s
     Running `target\debug\stork.exe build --input ..\content\stork-config.toml --output stork.st`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromIntError(())', stork-index-v3\src\build\fill_containers.rs:115:82
stack backtrace:
   0:     0x7ff6e985ca9f - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff6e985ca9f - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff6e985ca9f - std::sys_common::backtrace::_print_fmt
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff6e985ca9f - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff6e987526a - core::fmt::write
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\core\src\fmt\mod.rs:1163
   5:     0x7ff6e9854f78 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\io\mod.rs:1696
   6:     0x7ff6e985f716 - std::sys_common::backtrace::_print
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff6e985f716 - std::sys_common::backtrace::print
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff6e985f716 - std::panicking::default_hook::closure$1
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:210
   9:     0x7ff6e985f117 - std::panicking::default_hook
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:227
  10:     0x7ff6e985fd75 - std::panicking::rust_panic_with_hook
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:624
  11:     0x7ff6e985f95b - std::panicking::begin_panic_handler::closure$0
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:521
  12:     0x7ff6e985d3c7 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure$0,never$>
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys_common\backtrace.rs:139
  13:     0x7ff6e985f8b9 - std::panicking::begin_panic_handler
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:517
  14:     0x7ff6e987e440 - core::panicking::panic_fmt
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\core\src\panicking.rs:100
  15:     0x7ff6e987e553 - core::result::unwrap_failed
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\core\src\result.rs:1616
  16:     0x7ff6e8d1ffc0 - enum$<core::result::Result<u8,core::num::error::TryFromIntError> >::unwrap<u8,core::num::error::TryFromIntError>
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\library\core\src\result.rs:1298
  17:     0x7ff6e8d0a376 - stork_index_v3::build::fill_containers::fill_other_containers_alias_maps_with_prefixes
                               at C:\Users\Andreas\Documents\stork\stork-index-v3\src\build\fill_containers.rs:115
  18:     0x7ff6e8d09d10 - stork_index_v3::build::fill_containers::fill_containers
                               at C:\Users\Andreas\Documents\stork\stork-index-v3\src\build\fill_containers.rs:47
  19:     0x7ff6e8cc9f79 - stork_index_v3::build::build
                               at C:\Users\Andreas\Documents\stork\stork-index-v3\src\build\mod.rs:62
  20:     0x7ff6e8c9c2d9 - stork_lib::build_index
                               at C:\Users\Andreas\Documents\stork\stork-lib\src\lib.rs:158
  21:     0x7ff6e8c74d8d - stork::build_handler
                               at C:\Users\Andreas\Documents\stork\stork-cli\src\main.rs:91
  22:     0x7ff6e8c740b2 - stork::main
                               at C:\Users\Andreas\Documents\stork\stork-cli\src\main.rs:29
  23:     0x7ff6e8c7bc9b - core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\library\core\src\ops\function.rs:227
  24:     0x7ff6e8c93f1b - std::sys_common::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\library\std\src\sys_common\backtrace.rs:123
  25:     0x7ff6e8c76e41 - std::rt::lang_start::closure$0<tuple$<> >
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\library\std\src\rt.rs:146
  26:     0x7ff6e985c58b - core::ops::function::impls::impl$2::call_once
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\library\core\src\ops\function.rs:259
  27:     0x7ff6e985c58b - std::panicking::try::do_call
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:403
  28:     0x7ff6e985c58b - std::panicking::try
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:367
  29:     0x7ff6e985c58b - std::panic::catch_unwind
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panic.rs:133
  30:     0x7ff6e985c58b - std::rt::lang_start_internal::closure$2
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\rt.rs:128
  31:     0x7ff6e985c58b - std::panicking::try::do_call
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:403
  32:     0x7ff6e985c58b - std::panicking::try
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panicking.rs:367
  33:     0x7ff6e985c58b - std::panic::catch_unwind
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\panic.rs:133
  34:     0x7ff6e985c58b - std::rt::lang_start_internal
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\rt.rs:128
  35:     0x7ff6e8c76e0f - std::rt::lang_start<tuple$<> >
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\library\std\src\rt.rs:145
  36:     0x7ff6e8c76b36 - main
  37:     0x7ff6e987c720 - invoke_main
                               at d:\a01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  38:     0x7ff6e987c720 - __scrt_common_main_seh
                               at d:\a01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  39:     0x7ffee10e7034 - BaseThreadInitThunk
  40:     0x7ffee2242651 - RtlUserThreadStart
error: process didn't exit successfully: `target\debug\stork.exe build --input ..\content\stork-config.toml --output stork.st` (exit code: 101)

This stripped minimal example shows the offending part of my markdown file. Again, a very long URL (>128 chars) is involved. If I shorten this URL, everything is fine:

```go
---
foo
```

https://upload.wikimedia.org/wikipedia/commons/thumb/b/b1/Official_Presidential_portrait_of_Thomas_Jefferson_%28by_Rembrandt_Peale%2C_1800%29%28cropped%29.jpg/390px-Official_Presidential_portrait_of_Thomas_Jefferson_%28by_Rembrandt_Peale%2C_1800%29%28cropped%29.jpg

```go
bla
```

My environment:

  • Windows 10 pro x64, Version 21H1 (Build: 19044.1415)
  • cargo 1.57.0 (b2e52d7ca 2021-10-21)
  • npm 8.30
  • wasm-pack 0.10.2
  • HEAD of stork repo
@jameslittle230
Copy link
Owner

Oh no! I'll take another pass later today and fix that too.

@deining
Copy link
Author

deining commented Jan 3, 2022

Oh no! I'll take another pass later today and fix that too.

Thanks!

I just checked that there are no further offending markdown files are present in my project, and everything looks good 😃
While doing so, I came across another issue, however. The success message I got is given below:

C:\path\to\stork>stork.exe build --input ..\content\stork-config.toml --output stork.st
Warning: 1 error while indexing files. Your index was still generated, though the erroring files were omitted.
- The selector `main` is not present in the HTML document.
  _index.html
Index stats:
- 23 entries
- 13,759 search terms
- 1,205,548 bytes (52,415 bytes per entry, 87 bytes per search term)

- The selector `main` is not present in the HTML document.
  _index.htmlIndex built, 1,205,548 bytes written to stork.st.

In the last line, there should be a line break so that Index built, ... is on its own line.
Also, I'm wondering why the warning about a missing main selector is given twice.

Maybe you can correct this, too. Thanks.

@jameslittle230
Copy link
Owner

I think that's an artifact of you being on master (in that the error message handling might be better in 1.3.0 and/or once I merge #222, but I'll take a pass there, too.

Thanks for reporting these! I really appreciate it!

@jameslittle230
Copy link
Owner

Fixed in #231.

I'll take a look at that error message!

@jameslittle230
Copy link
Owner

I've fixed the duplicate error message in #222 - thanks again for the reports!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants