Confilicting chdir in static.rb


#1

After upgrading to ruby 2.5.0 bundle exec rake started to show this warning:

warning: conflicting chdir during another chdir block

and point to this line:

https://github.com/hanami/hanami/blob/master/lib/hanami/static.rb#L52

The test suite ends with errors to load any template file:

Errno::ENOENT: No such file or directory @ rb_sysopen - apps/research/templates/analysis/dictionary.html.erb

Obviously these paths exist respectively to the project root. How to fix it?


#2

We have the same problem. It was really tricky to find the cause because it only occurred in the production environment and only sporadic because we are behind a CDN and it seems to be only triggered if assets are delivered (CDN miss).

We downgraded to ruby 2.4.3 and everything works fine again but I also noticed that we still get the occasional warning warning: conflicting chdir during another chdir block but without the error that ‘kills’ the process.

We do not have problems with template files but with files we ‘manually’ load with a relative path (like some yml files via YAML.load_file('lib/data/some.yml')) or even with translation files (via the i18n gem).

We could try to load everything with absolute paths but that would not help with some gems and would be dangerous because we only ever notice the problem in production.

I’m not sure if this is a Hanami or Ruby issue but I didn’t find any other mentioning of this. Does anybody have more insight what the ‘real’ problem is?


#3

I saw this as well. I submitted a PR with a fix that worked for me.