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

typst-ts-cli Crash Report #377

Open
ntjess opened this issue Oct 15, 2023 · 3 comments
Open

typst-ts-cli Crash Report #377

ntjess opened this issue Oct 15, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@ntjess
Copy link

ntjess commented Oct 15, 2023

Describe the bug
Running typst-ts-cli c --watch --entry main.typ produces the following error:

name = "typst-ts-cli"
operating_system = "Pop!_OS 22.04 (jammy) [64-bit]"
crate_version = "0.4.0-rc3"
explanation = """
Panic occurred in file '/home/runner/work/typst.ts/typst.ts/compiler/src/service/watch.rs' at line 23
"""
cause = "called `Result::unwrap()` on an `Err` value: \"failed to watch directory (Too many open files (os error 24))\""
method = "Panic"
backtrace = """

   0: 0x55f28d671cc2 - <unresolved>
   1: 0x55f28e1497a2 - <unresolved>
   2: 0x55f28e137d29 - <unresolved>
   3: 0x55f28e168632 - <unresolved>
   4: 0x55f28e13ae6f - <unresolved>
   5: 0x55f28e13a8d7 - <unresolved>
   6: 0x55f28d6c6675 - <unresolved>
   7: 0x55f28d6c5803 - <unresolved>
   8: 0x55f28e1774f3 - <unresolved>
   9: 0x55f28d6cefb9 - <unresolved>
  10: 0x7f1527829d90 - <unresolved>
  11: 0x7f1527829e40 - __libc_start_main
  12: 0x55f28d6beb95 - <unresolved>
  13:        0x0 - <unresolved>"""

Even if I have no open files on the system. The same command works great if --watch is not specified. This is likely related to Enter-tainer/typst-preview#133

@Myriad-Dreamin
Copy link
Owner

It is possibly complaining exhausted inotify watch handlers. https://youtrack.jetbrains.com/articles/IDEA-A-2/Inotify-Watches-Limit-Linux

Unfortunately, the default limit of watch handles may not be enough for reasonably sized projects, and reaching the limit will force IntelliJ platform to fall back to recursive scans of directory trees.

Btw, the watch functionality is already improved, which is identified in Enter-tainer/typst-preview#130. You could try nightly cli of typst.ts by:

cargo install --locked --git https://github.com/Myriad-Dreamin/typst.ts typst-ts-cli

@ntjess
Copy link
Author

ntjess commented Oct 16, 2023

Thank you for the explanation! I tried the nightly build per your instructions and received this error --watching. Is it expected to work currently?

Edit: I increased the inotify threshold and things started working again. I incorrecty assumed the nightly build would resolve the issue, sorry for the confusion

name = "typst-ts-cli"
operating_system = "Pop!_OS 22.04 (jammy) [64-bit]"
crate_version = "0.4.0-rc8"
explanation = """
Panic occurred in file 'compiler/src/service/watch.rs' at line 302
"""
cause = "internal error: entered unreachable code"
method = "Panic"
backtrace = """

   0: 0x5649fbcd6d53 - core::panicking::panic::hd907d42d09324a32
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:117
   1: 0x5649fc90b2fc - typst_ts_compiler::service::watch::NotifyActor::update_watches::he28b5b7877f828b3
                at <path>.cargo/git/checkouts/typst.ts-bd03698c1f5efd74/4ef85dc/compiler/src/service/watch.rs:302
   2: 0x5649fc88bc1a - typst_ts_compiler::service::watch::NotifyActor::run::{{closure}}::h3cb6fdcc50438f07
                at <path>.cargo/git/checkouts/typst.ts-bd03698c1f5efd74/4ef85dc/compiler/src/service/watch.rs:192
   3: 0x5649fc88d899 - tokio::runtime::task::core::Core<T,S>::poll::{{closure}}::h86c90a1db15278e4
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:334
                 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h2b488d4aa8b6d73e
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/loom/std/unsafe_cell.rs:16
                 - tokio::runtime::task::core::Core<T,S>::poll::h267b4580b832ab9c
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:323
   4: 0x5649fc8a4f1f - tokio::runtime::task::harness::poll_future::{{closure}}::h011f66b8b3bc7740
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:485
                 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h5cf263e2c5ade3d3
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panic/unwind_safe.rs:271
                 - std::panicking::try::do_call::hf1e87da13fb616bd
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:502
                 - std::panicking::try::hb5b1afa12a1496dc
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:466
                 - std::panic::catch_unwind::he5f5114a4d6ebdc1
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panic.rs:142
                 - tokio::runtime::task::harness::poll_future::h18799510dd3cf4ab
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:473
                 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::h0a779a599abf0116
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:208
                 - tokio::runtime::task::harness::Harness<T,S>::poll::hd4c38e904ffef034
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:153
   5: 0x5649fc3bc526 - tokio::runtime::task::raw::RawTask::poll::hd979ac493f6e6396
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/raw.rs:200
                 - tokio::runtime::task::LocalNotified<S>::run::h9abd89ec56ed5520
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/mod.rs:400
                 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}}::h9c0a45633fe86326
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:576
                 - tokio::runtime::coop::with_budget::h5fb1cb2dff5d3261
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/coop.rs:107
                 - tokio::runtime::coop::budget::h4c0fdbecdb32fd0e
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/coop.rs:73
                 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::hf0b2688e5dc9eae1
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:575
   6: 0x5649fc3b8baa - tokio::runtime::scheduler::multi_thread::worker::Context::run::h229c36eebf05179d
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:526
                 - tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}}::h0fd97e5851d59bbb
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:491
                 - tokio::runtime::context::scoped::Scoped<T>::set::h6c29988862822aaf
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context/scoped.rs:40
                 - tokio::runtime::context::set_scheduler::{{closure}}::hafeed4ee7544fc58
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context.rs:176
                 - std::thread::local::LocalKey<T>::try_with::h1fba0ffe833a10aa
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/local.rs:270
                 - std::thread::local::LocalKey<T>::with::h9451ed4a73bdd55c
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/local.rs:246
                 - tokio::runtime::context::set_scheduler::h45c9f4d59c07d6d5
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context.rs:176
   7: 0x5649fc3a6125 - tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::h9ad37de13f53a5fb
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:486
                 - tokio::runtime::context::runtime::enter_runtime::ha43fe0b86102138c
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/context/runtime.rs:65
   8: 0x5649fc3bc3b8 - tokio::runtime::scheduler::multi_thread::worker::run::h55a04ac75055b477
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:478
   9: 0x5649fc3b2c36 - tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}}::h3cbb8eb3a2fb4d16
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/scheduler/multi_thread/worker.rs:447
                 - <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll::he1c0496f7016f0fc
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/task.rs:42
                 - tokio::runtime::task::core::Core<T,S>::poll::{{closure}}::h74225d5c4884e925
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:334
                 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h0ad486205ad11638
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/loom/std/unsafe_cell.rs:16
                 - tokio::runtime::task::core::Core<T,S>::poll::h852efd87caaacd75
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/core.rs:323
  10: 0x5649fc3a2cfe - tokio::runtime::task::harness::poll_future::{{closure}}::h182f813820c5d0f4
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:485
                 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h9508ee3caea59b55
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panic/unwind_safe.rs:271
                 - std::panicking::try::do_call::he62586d6a24a6e76
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:502
                 - std::panicking::try::h06003806ae50046d
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:466
                 - std::panic::catch_unwind::h21a1ee810987905b
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panic.rs:142
                 - tokio::runtime::task::harness::poll_future::h5d651a9c5c9e6521
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:473
                 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::h0b65bc8005146f32
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:208
                 - tokio::runtime::task::harness::Harness<T,S>::poll::h377aaf15bfe5952f
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/harness.rs:153
  11: 0x5649fc3c00bf - tokio::runtime::task::raw::RawTask::poll::hd979ac493f6e6396
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/raw.rs:200
                 - tokio::runtime::task::UnownedTask<S>::run::hf045cdb9e765b6e4
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/task/mod.rs:437
                 - tokio::runtime::blocking::pool::Task::run::hf3d3f46f717e690d
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/pool.rs:159
                 - tokio::runtime::blocking::pool::Inner::run::h76e9a3d2b198a02c
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/pool.rs:513
  12: 0x5649fc3c08ba - tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}::h017ac52bd013f210
                at <path>/index.crates.io-6f17d22bba15001f/tokio-1.32.0/src/runtime/blocking/pool.rs:471
                 - std::sys_common::backtrace::__rust_begin_short_backtrace::hda5158adf1fc44dc
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys_common/backtrace.rs:154
  13: 0x5649fc3a7fa3 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h335e573778431db5
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:529
                 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h46ee7676b5c4306f
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panic/unwind_safe.rs:271
                 - std::panicking::try::do_call::h1ed17e1c634acdf4
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:502
                 - std::panicking::try::he8b37bdc96d10f9e
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:466
                 - std::panic::catch_unwind::hfd97d941da7ff21a
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panic.rs:142
                 - std::thread::Builder::spawn_unchecked_::{{closure}}::h65bf59c10ffd0586
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/thread/mod.rs:528
                 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h9bf671cc49639c86
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250
  14: 0x5649fc2f5a55 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haadd4e5af2ab0d62
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007
                 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he4ba1fb09c16d807
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/alloc/src/boxed.rs:2007
                 - std::sys::unix::thread::Thread::new::thread_start::he524ecf4b47bee95
                at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/sys/unix/thread.rs:108
  15: 0x7fca19694b43 - <unresolved>
  16: 0x7fca19726a00 - <unresolved>
  17:        0x0 - <unresolved>"""

@Myriad-Dreamin
Copy link
Owner

@ntjess Thank you for trying nightly build. It is unfortunately that the nightly build does not mitigate the situation, hence does not work.

I increased the inotify threshold and things started working again.

This is the general solution when you meets the general error Too many open files, which is not specific to typst-ts-cli. The error means that your OS has reached strict limit to file handles to watch. And other typst programs may also guide users to Inotify Watches Limit Linux, such as typst-cli, typst-lsp, and typst-preview.

@Myriad-Dreamin Myriad-Dreamin added the documentation Improvements or additions to documentation label Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants