You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error thread 'main' has overflowed its stack shows on windows when trying to programatically run migrations:
The bin crate is not part of a workspace (it's a top level crate with no workspace) --> stack overflow
The bin crate is part of a workspace, but the cargo run --bin X command is ran from the workspace directory ---> stack overflow
The bin crate is part of a workspace, the directory was changed to the sub-crate ---> no stack overflow
After some debugging I found the overflow happens in MigrationBuilder::build(), CodeSchema::get_models_from_code() because WalkDir() hits the decently-sized target/ directory in the workspace.
The command should not scan any target/ directory, or any directory outside src/.
Adding .max_depth(4) to the WalkDir removes the error (but limits arrangement).
It now avoids scanning target/, collects all src/, then iterates those src/ only.
The migrate commands might still be slow if you happen to have a lot of data in a folder in the workspace or crate root. Might be useful to automatically ignore files listed in .gitignore, as is the case here.
Even better would be to parse the workspace Cargo.toml structure to get the list of members, and only scan those.
The text was updated successfully, but these errors were encountered:
The error
thread 'main' has overflowed its stack
shows on windows when trying to programatically run migrations:cargo run --bin X
command is ran from the workspace directory ---> stack overflowAfter some debugging I found the overflow happens in
MigrationBuilder::build()
,CodeSchema::get_models_from_code()
becauseWalkDir()
hits the decently-sizedtarget/
directory in the workspace.The command should not scan any
target/
directory, or any directory outsidesrc/
.Adding
.max_depth(4)
to the WalkDir removes the error (but limits arrangement).Added commit on top of other PR: fac8b40
It now avoids scanning target/, collects all src/, then iterates those src/ only.
The migrate commands might still be slow if you happen to have a lot of data in a folder in the workspace or crate root. Might be useful to automatically ignore files listed in
.gitignore
, as is the case here.Even better would be to parse the workspace
Cargo.toml
structure to get the list of members, and only scan those.The text was updated successfully, but these errors were encountered: