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

sn parallel on non-existent paths creates an infinite loop #16

Open
hcpl opened this issue Nov 13, 2018 · 1 comment
Open

sn parallel on non-existent paths creates an infinite loop #16

hcpl opened this issue Nov 13, 2018 · 1 comment

Comments

@hcpl
Copy link

hcpl commented Nov 13, 2018

For example, create an empty directory and call sn p foo in it.

@hcpl
Copy link
Author

hcpl commented Nov 13, 2018

The culprit is this section:

// assign work to everyone
Walk::push_subdir(&w, &mut worker, &arc_local);
// start popping off values in the worker's thread
loop {
if let Pop::Data(p) = worker.pop() {
match p {
Status::Data(d) => Walk::print_dir(&d, &arc_local),
_ => break,
}
}
}

If the path doesn't exist then Walk::push_subdir doesn't assign any work to the worker. So in turn, worker.pop() will always return Pop::Empty and the loop silently ignores this case, creating an infinite loop.

@hcpl hcpl changed the title sn parallel on non-existent paths consume 100% CPU sn parallel on non-existent paths creates an infinite loop Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant