vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.42k stars 1.84k forks source link

[turborepo] broken input globs cause turbo to hang #6016

Closed NullVoxPopuli closed 1 year ago

NullVoxPopuli commented 1 year ago

What version of Turborepo are you using?

1.10.14

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Linux / Ubuntu, 23.04

Describe the Bug

turbo makes no progress and stops here when running with --verbosity 3

❯ pnpm turbo run test:lint --verbosity 3
2023-09-24T19:21:27.061-0400 [DEBUG] turborepo_lib::shim: Global turbo version: 1.10.14
2023-09-24T19:21:27.069-0400 [DEBUG] turborepo_lib::shim: No local turbo binary found at: /home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam/node_modules/turbo-linux-64/bin/turbo
2023-09-24T19:21:27.069-0400 [DEBUG] turborepo_lib::shim: No local turbo binary found at: /home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam/node_modules/turbo/node_modules/turbo-linux-64/bin/turbo
2023-09-24T19:21:27.069-0400 [DEBUG] turborepo_lib::shim: Local turbo path: /home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam/node_modules/.pnpm/turbo-linux-64@1.10.14/node_modules/turbo-linux-64/bin/turbo
2023-09-24T19:21:27.069-0400 [DEBUG] turborepo_lib::shim: Local turbo version: 1.10.14
2023-09-24T19:21:27.069-0400 [DEBUG] turborepo_lib::shim: Repository Root: /home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam
2023-09-24T19:21:27.070-0400 [DEBUG] turborepo_lib::shim: Running local turbo binary in /home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam/node_modules/.pnpm/turbo-linux-64@1.10.14/node_modules/turbo-linux-64/bin/turbo

2023-09-24T19:21:27.070-0400 [DEBUG] turborepo_lib::shim: supports_skip_infer_and_single_package true
2023-09-24T19:21:27.070-0400 [DEBUG] turborepo_lib::shim: Global turbo version: 1.10.14
2023-09-24T19:21:27.070-0400 [TRACE] log: registering event source with poller: token=Token(1), interests=READABLE
2023-09-24T19:21:27.071-0400 [DEBUG] turborepo_lib::cli: pkg_inference_root set to ""
2023-09-24T19:21:27.072-0400 [TRACE] turborepo_lib::execution_state: Found pnpm as package manager
2023-09-24T19:21:27.072-0400 [DEBUG] turbo: Found go binary at "/home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam/node_modules/.pnpm/turbo-linux-64@1.10.14/node_modules/turbo-linux-64/bin/go-turbo"
2023-09-24T19:21:27.072-0400 [TRACE] turbo: Invoking go binary with {"api_client_config":{"token":null,"team_id":null,"team_slug":null,"api_url":"https://vercel.com/api","use_preflight":false,"timeout":20},"spaces_api_client_config":{"token":null,"team_id":null,"team_slug":null,"api_url":"https://vercel.com/api","use_preflight":false,"timeout":20},"package_manager":"pnpm","cli_args":{"api":null,"color":false,"cpu_profile":null,"cwd":"/home/nullvoxpopuli/Development/OpenSource/starbeam/starbeam","heap":null,"login":null,"no_color":false,"preflight":false,"remote_cache_timeout":null,"team":null,"token":null,"trace":null,"verbosity":3,"test_run":false,"command":{"Run":{"cache_dir":null,"cache_workers":10,"concurrency":null,"continue_execution":false,"dry_run":null,"single_package":false,"filter":[],"force":null,"framework_inference":true,"global_deps":[],"graph":null,"env_mode":"Infer","ignore":[],"include_dependencies":false,"no_cache":false,"no_daemon":false,"no_deps":false,"output_logs":null,"log_order":"auto","only":false,"parallel":false,"pkg_inference_root":"","profile":null,"remote_only":false,"scope":[],"since":null,"summarize":null,"log_prefix":"auto","tasks":["test:lint"],"pass_through_args":[],"experimental_space_id":null,"experimental_rust_codepath":false}}}}
2023-09-24T19:21:27.075-0400 [DEBUG] turbo: build tag: rust
2023-09-24T19:21:27.137-0400 [DEBUG] turbo: running in daemon mode
2023-09-24T19:21:27.138-0400 [DEBUG] turbo: global hash env vars: vars=[]
2023-09-24T19:21:27.142-0400 [DEBUG] turbo: global hash: value=d663a0d8a5b987b2
2023-09-24T19:21:27.142-0400 [DEBUG] turbo: local cache folder: path=""

Expected Behavior

command proceeds

To Reproduce

Use this turbo.json:

{
  "$schema": "https://turbo.build/schema.json",
  // Additive to package.json and turbo.json
  //
  // https://turbo.build/repo/docs/core-concepts/caching/file-inputs#specifying-additional-inputs
  "globalDependencies": [
    ".github/workflows/ci.yml",
    ".npmrc",
    ".eslintrc.json",
    ".eslintrc.repo.json",
    "pnpm-lock.yaml",
    "pnpm-workspace.yaml",
    "patches",
    "vitest.config.ts",
    "vitest.workspace.ts",
    "tsconfig.json",
    "tsconfig.root.json"
  ],
  "pipeline": {
    "lint": {
      "dependsOn": ["test:lint"],
      "outputs": []
    },
    "test:lint": {
      "outputs": [],
      // We manually manage inputs
      // because we have nested workspaces.
      // We want to omit the tests workspace
      // for example.
      "inputs": ["src/**", "*.{ts,js,mjs,json,mts,cjs,cts"]
    },
    "test:types": {
      "outputs": [],
      // We manually manage inputs
      // because we have nested workspaces.
      // We want to omit the tests workspace
      // for example.
      "inputs": ["src/**", "*.{ts,js,mjs,json,mts,cjs,cts"]
    },
    "typecheck": {
      "dependsOn": ["test:types"],
      "outputs": []
    }
  }
}

Reproduction Repo

https://github.com/starbeamjs/starbeam/pull/132

The command I ran:

pnpm turbo run test:lint --verbosity 3

dry-run hangs, too:

pnpm turbo run test:types --dry-run=json \
| jq 'reduce .tasks[] as {$package,$task,$inputs} ({};
      .[$package][$task] |= $inputs
     )' \
| jq '."@starbeam/vue"'
nathanhammond commented 1 year ago

We're aware of a globbing issue on Linux. I suspect that pinning to one of 1.10.3 or 1.9.5 will work around this issue. Probably the same as #5773 and #5908.

gsoltis commented 1 year ago

@NullVoxPopuli I think you have a bad glob: here and here you are missing a closing }.

However. turbo should definitely not just hang in that situation. Looking into what's going on there.

NullVoxPopuli commented 1 year ago

oh no! how embarrassing for me :sweat_smile:

thanks for looking in to it. it'd be great if the we had line/column-aware errors for stuff like this :muscle:

nathanhammond commented 1 year ago

@NullVoxPopuli Coming soon: biome-json-parser to parse JSON with spans because serde_json can't do it.

nathanhammond commented 1 year ago

Closing this issue out as resolved and we'll trace perf issues in the other two reports.

nathanhammond commented 1 year ago

Actually, no, I'm going to repurpose this issue. Broken globs shouldn't break us.