moonrepo / moon

A build system and monorepo management tool for the web ecosystem, written in Rust.
https://moonrepo.dev/moon
MIT License
2.84k stars 155 forks source link

[bug] Startup issues: `tool::unknown` & `SIGSEGV` #1663

Open alexbepple opened 1 week ago

alexbepple commented 1 week ago

Quite frequently (in 30% to 50% of invocations), moon does not execute properly for me.

I get two kinds of errors. Firstly,

❯ moon :pre-commit
fish: Job 1, 'moon :pre-commit' terminated by signal SIGSEGV (Address boundary error)

Secondly,

❯ moon :pre-commit
Error: tool::unknown

  × Node has not been configured or installed, unable to proceed.

Context

Apple M1 Pro macOS 13.1

Errors happen with moon 1.25.6, 1.26.7, 1.27.6, 1.28.3. Errors do not not happen with moon 1.22.10

The issue is quite annoying. Unfortunately, I have not been able to reliably reproduce the errors. → What information should I collect in order to enable you to understand what’s going on and fix this?

milesj commented 1 week ago

That first error seems very weird, never seen that before. As for the second, what's your toolchain config look like?

If possible, it would be helpful if you can capture the --log trace output for one of these failures.

alexbepple commented 6 days ago

Traces

Node-not-configured-installed.trace.log SIGSEGV.trace.log

In the trace for "Node has not been configured or installed, unable to proceed.", there is an explicit failure of something. Looking around (without any real understanding of what’s going on), I found it suspicious that there are two attempts to lock ~/.proto/tools/yarn/manifest.json.

Toolchain config

It’s pretty straightforward, I think.

.moon/toolchain.yml:

node:
  packageManager: 'yarn'
  yarn:
    version: '4.3.1'

And the Node version is specified for individual projects. …/moon.yml:

toolchain:
  node:
    version: 20.14.0

…
alexbepple commented 6 days ago

I narrowed down the version that introduced this behavior: 1.25.0. 1.24.6 is still fine, but 1.25.0 exhibits this undesirable behavior.

1.25.0 also outputs this:

[ERROR 2024-09-25 18:11:48.967] log:run  Encountered a critical error, aborting the action pipeline  log.target="moon_action_pipeline::pipeline" log.module_path="moon_action_pipeline::pipeline" log.file="legacy/core/action-pipeline/src/pipeline.rs" log.line=398

Maybe it’s helpful.

I also generated the trace for 1.25.0: moon.1.25.0.Node-not-configured-installed.trace.log