-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Inconsistent output across runs (on OS X) #1
Comments
Need more information in order to reproduce this.
|
All I did was run |
That is very odd. Can you try running on a single directory with one file in it and see if its reproducible there? Then add the to option --trace
That should allow me to at least guess what might be going on. |
OK, so when I try it on a single dir it's consistent. Even on a dir that contains other dirs that contain code it is fine. But I think I have a reproducible test case for you: |
Are you seeing different counts on the totals? You probably will see flipping between the following
That's because the sorting us done by Files rather than the name which is what Tokei does. Since they are the same value of 15 its down to whatever the runtime decides to do when the sort is invoked. You can control it to be like tokei by doing the following I might move the default over to sort by lines, however it will have the same issue if the line counts match. I made it based on files because that's what I wanted to see. |
I'm seeing the file count for Go flip between 519 (the correct value) and something between 235 and 240 (it varies each time). |
Must be something to do with the Go runtime on macOS. That is frustrating. I don't have access to an macOS machine. My guess at the moment is that its something to do with the parallel walking of the file tree. If you drop down a single directory and run it does it work? That is drop down so that there is only a single directory where you run If that turns out to be the case I will turn off the parallel file walk for Darwin arch until I can determine what the root cause issue is. |
I believe that's what I already tried with the parent dir of reftools, which only contains reftools. Here's the console output: amdsouza-macbookair:davidrjenni amdsouza$ ls
|
Odd that it only affects the Go counts. Can you please try checking out and installing from this branch https://github.com/boyter/scc/tree/Issue1 Then see if the new option |
Even with the --npw flag I still get inconsistent results for the number of Go files in the davidrjenni dir. |
Have been trying this out on a 2013 Retina Macbook Pro. I am totally unable to replicate the issue. I have included the results I get. Tried running it a dozen times and the results are always 100% the same.
However this is running macOS Sierra 10.12.6 and not High Sierra which may explain the difference. Are you using High Sierra? |
I am using High Sierra but also you are doing one key thing differently. |
I copied the above from the last run when I was trying to replicate. No matter where I ran it I had the same result. For the record I tried the following all inside
I am starting to suspect that it may be something to do with High Sierra. The only thing I can think of is that somehow when it traverses the file-tree it does so in a way that nothing else does and possibly causes the files to be excluded. When you run this with the
The order of the above is not deterministic but the count should be 100% the same and they should match if you for instance sorted the output. I have a feeling that in your case they would not be. You can verify this using I will see if I can get the person whom I borrowed the Macbook from to upgrade to High Sierra but I suspect that may be unlikely. |
Ah, using -v & looking at the warning provided a very useful clue; many lines like this: That probably explains what's happening: scc is bumping up against some limit on the number of files that can be open concurrently. |
Ah yes. It is designed to pull as much from the disk as possible. Sounds like you are hitting the ulimit issues. https://superuser.com/questions/261023/how-to-change-default-ulimit-values-in-mac-os-x-10-6#306555 I will update the documentation to mention this I think. Interesting that tokei does not hit the limit. I might have to look into how to control or at least change the limit when the application runs. https://stackoverflow.com/questions/17817204/how-to-set-ulimit-n-from-a-golang-program#17818022 Looks promising. |
Dang, that warning was a red herring. I fixed the limits an now I no longer see those warnings but I still get inconsistent numbers :( |
That is rather annoying. Are the verbose responses different at all when the numbers are different? |
N/m: I had make a wee mistake earlier; raising the open file limit to 4096 seems to have done the trick after all. |
Ah great. It seemed such a perfect fit. Ill have a look at implementing the above then. Oh annoyingly its one of those ones that requires sudo apparently. I might just add it to the documentation. Most dev's raise the ulimit anyway. Might be possible to add it as better reporting output. |
Going to close this down now. Thanks so much for working through it with me. |
Every time I run scc on the same codebase on my Macbook, I get completely different results. Even the file count changes every time I run it!
The text was updated successfully, but these errors were encountered: