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
Nanoc (almost) always crashing at build #1338
Comments
Yikes! Can you reproduce this problem with Nanoc 4.9.1 too? (Rather than the current, 4.9.2.) |
Ok, I can definitely reproduce it with 4.9.1, and even sometimes with 4.9.0 (but in that version, it is quite rare) Could it be Ruby 2.5 that messed it up ? Or am I one of the only ones that get to have that ? |
Hmm — there are two possibly relevant changes in Nanoc recently that could be related:
But from the looks of it, even asynchronous writes shouldn’t be causing this particular kind of error. Could you test out with Nanoc 4.8.9? That one might not be easy because of new features introduced in 4.9.0, so no worries if that’s not simple. Some questions:
|
After a bit of testing, it seems that Nanoc 4.8.9 is ok, no bug Also, I had a preprocess rule that removed non-published files, but it didn't change anything having it or not :/ |
Huh, this bug has me stumped. Some observations:
@Doshirae A question for you: can you double-check that no other Nanoc process is running that could interfere? |
@Doshirae Is this still an issue for you? |
Yes, nothing have changed. I guess I'm gonna try to patch the code to stop that from happening :/ |
@Doshirae Is 4.8.9 the most recent version where this problem does not happen? (In other words, is 4.8.10 the first version where it happens?) Narrowing down the problem to a specific version would help me pinpoint the problem — I’ve not had much luck identifying the problem so far. |
I retried with 4.8.9 It does crash every first time and it seems to be uncorellated with the release I'm using. |
@Doshirae This is still quite odd, because Nanoc supposedly creates the directory before creating files inside the directory. Which filesystem(s) are you using? |
I'm on a good ol' |
@Doshirae Can you run the following script to see whether it crashes? require 'fileutils'
dirs = [
'/tmp',
File.expand_path('~'),
]
TMP = 'jeOsTZxRlHRXwmJG6soAMM3LB2705b'
dirs.each do |dir|
Dir.chdir(dir) do
print "Testing in #{dir} (reusing dir)… "
20.times do
FileUtils.mkdir_p(TMP)
File.write(TMP + '/a.txt', 'stuff')
FileUtils.rm_rf(TMP)
end
puts "ok"
print "Testing in #{dir} (new dir)… "
20.times do |i|
dir = "#{TMP}#{i}"
FileUtils.mkdir_p(dir)
File.write(dir + '/a.txt', 'stuff')
FileUtils.rm_rf(dir)
end
puts "ok"
end
end
puts "done" It repeatedly creates directories and files in them, in quick succession. None of it should fail, and it doesn’t on my machine, but I’m wondering whether there’s any configuration of your filesystem that makes it not work. |
It works fine and doesn't crash :/ |
@Doshirae Could I get a copy of your site so that I can investigate by myself? I’m not making progress on this issue. |
Sure, I've made the files available here : https://files.doshi.re/Blog-files/ |
@Doshirae wget works — although I had to remove the I can build the site properly on my machine (macOS 10.13.6). I’ve also tested it out Debian with ext4 (Debian 9) where it also works properly. In both setups, I’ve done the compilation a few dozen times in quick succession, with no failures. Can you share your |
Unrelated: I recommend Bundler for specifying the dependencies you use; it makes it easy to install dependencies on a new system. The
|
|
The Going to take another look at this soon! |
With the same ext4 options that you’re using, I also still can’t reproduce the issue :( |
What a nightmare >< Maybe is it because I'm on an encrypted partition ? Anyway, my system is quite bloated and have some issues, I was planning on reinstalling it (but my laziness kept me). |
@Doshirae I’m out of ideas as to what could cause this — if you feel like digging into the code of Though if the issue no longer happens after a system reinstall, it might be worth closing it — and reopen it when/if the issue reappears. |
I have new clues from my computer ! |
For what it is worth, I am having exactly the same issue for some time (same crashes and output folders in the parent folders). Issue occurs on macOS 10.13.6 with nanoc 4.9.0 and Ruby 2.5. I don't have the issue compiling exactly the same site on my older MacBook installation with macOS 10.13.6 Nanoc 4.8.11 and Ruby 2.4.2. |
Downgraded to 4.8 for now, will follow this discussion to see when I can upgrade again. |
Thanks for the extra information I’m on holiday at the moment, but will take another closer look at this afterwards. The @Doshirae The link to https://doshi.re/Rakefile.txt is broken, I’m afraid. |
Nanoc at the moment has an implicit dependency on the current working directory. This might be the cause of this problem. I’m working on removing that dependency now; this should hopefully fix this issue. |
My issue seems solved, from what I tested |
Excellent… and sorry for taking so long to identify the source of the problem! |
The fix is released in Nanoc 4.9.5. |
Just adding a little bit of info to this thread in case anyone comes Googling here: The current working directory in Ruby is global across threads. So if you have any code depending on the current working directory then a ruby process running in another thread can crash that. In my case I had rake task running a second task in parallel to nanoc that crashed it, so completely outside nanoc. There has been some discussion on the Ruby mailing list about this, but apparently it's not something that can be changed as the underlying OS is what defines this behaviour. |
@Fjan Good follow-up! The consensus on global mutable state is that it’s bad, but global mutable state creeps up in non-obvious ways. Global mutable state isn’t just global variables (
I was aware that depending on the current working directory is problematic, but it slipped my mind and ended up not fixing the problem. |
Well, the title says it all : when I happen to build my nanoc site, I have to build it several times before it eventually works
Steps to reproduce
Really I don't know what is causing it, so I can't help on this part…
Expected behavior
I expect the site to build properly
Actual behavior
First build attempt :
Errno::ENOENT: No such file or directory @ rb_sysopen - output/2018/04/le-post-rock/index.html
Second build attempt :
Errno::ENOENT: No such file or directory @ rb_sysopen - output/2018/04/le-post-rock/index.html
Third build attempt :
Errno::ENOENT: No such file or directory @ rb_sysopen - output/2018/01/le-blog-est-lisible-sur-mobile/index.html
Fourth build attempt :
Now it builds
Details
Obviously, all the files that nanoc thinks are missing are here on my filesystem
I also sometimes get errors like
Errno::ENOENT: No such file or directory @ rb_file_s_link - (/tmp/nanoc20180423-21843-10r5xok/text_items/0, output/2018/04/le-post-rock/index.html)
with this crashlogAnd sometimes, it just builds normally
Crash log
Sorry, I'm using my own paste thingy, because Gist just deletes the newlines of the crash log, and I don't have the time or the patience to add them back
First crash log : https://p.patate-douce.me/4c93ff
Second crash log : https://p.patate-douce.me/e40cd0
Third crash log : https://p.patate-douce.me/045d3f
The text was updated successfully, but these errors were encountered: