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

[bug] query projects stack overflow #1079

Closed
shellscape opened this issue Sep 28, 2023 · 4 comments · Fixed by #1082
Closed

[bug] query projects stack overflow #1079

shellscape opened this issue Sep 28, 2023 · 4 comments · Fixed by #1082
Assignees
Labels
bug Something isn't working

Comments

@shellscape
Copy link

shellscape commented Sep 28, 2023

Describe the bug

Running moon query projects results in:

thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow

Steps to reproduce

Not entirely sure how to reproduce this, since it probably relies on the repo structure. Here's the workspace.yml file:

# https://moonrepo.dev/docs/config/workspace
$schema: 'https://moonrepo.dev/schemas/workspace.json'

projects:
  - 'apps/*'
  - 'infra/core'
  - 'services/*'
  - '.'

vcs:
  manager: 'git'
  defaultBranch: 'dev'

--log trace output is 6k+ lines long, so I dumped it into a gist and redacted sensitive bits: https://gist.github.com/shellscape/765445ce5a77bf11cbf73118e1643d09

Expected behavior

Project list to be output to console

Screenshots

Environment

MacOS Ventura
Node 18
Moon 1.14.1

Additional context

@shellscape shellscape added the bug Something isn't working label Sep 28, 2023
@shellscape
Copy link
Author

shellscape commented Sep 28, 2023

This is affecting moon run in the same repo as well. Moon has been effectively disabled by this one.

If I remove the - '.' line in workspace.yml the overflow ceases. Not sure why, since I'm using that same setup in 3 other repos at the moment.

@shellscape
Copy link
Author

shellscape commented Sep 28, 2023

More investigation:

If the root package.json contains { "name": "repo" } and the root repo directory is named myrepo and the root moon.yml file has tasks that use repo:task-name then the stack overflow occurs.

If I change all of the repo:task-name use in the root moon.yml file to myrepo:task-name, and leave the package.json file as-is-above, then the stack overflow does not occur.

I just verified the same behavior in another public repo that you could use to debug here: https://github.com/shellscape/jsx-email

What's wild is that I'm able to call moon repo:lint from the terminal (second scenario listed above) as moon does identify it as a valid alias.

@milesj
Copy link
Collaborator

milesj commented Sep 28, 2023

@shellscape This is a wild bug. Thanks for digging into the root cause. This would of taken me a long time to figure out. Now let me try and reproduce it locally.

@milesj
Copy link
Collaborator

milesj commented Sep 28, 2023

I know the problem: https://github.com/moonrepo/moon/blob/master/nextgen/project-graph/src/project_graph_builder.rs#L345

It's because we set the alias after the project has been created. And since these tasks are referencing tasks in the same project, it's using the alias before it's been set. Let me see if there's a way to set it earlier.

Edit: That didn't fix it 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants