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

Middleman Server + Symlink to directory: Server crashes during 2nd reload #2054

Open
yas4891 opened this issue Feb 15, 2017 · 6 comments

Comments

@yas4891
Copy link

@yas4891 yas4891 commented Feb 15, 2017

Expected behavior and actual behavior

  • Added a symlink from /source/image to ~/Dropbox/Geschäft/hyphenated-domain.com/images
  • running middleman server changed a file - layout includes images from /source/image

expected:

  • when viewing website in browser the website gets updated even after 2+ reloads

actual:

  • either the page "freezes" i.e. changes to the file do not get shown OR I get a "File not found" page (I'm as of yet unclear on what causes the two different behaviors)

Stack trace

E, [2017-02-15T06:06:35.310159 #3898] ERROR -- : exception while processing events: Is a directory @ io_fread - /Users/killerrobot/projects/mywebsite/source/images Backtrace:
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/util/binary.rb:70:in `read'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/util/binary.rb:70:in `file_contents_include_binary_bytes?'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/util/binary.rb:38:in `binary?'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/resource.rb:175:in `binary?'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/core_extensions/front_matter.rb:37:in `block in manipulate_resource_list'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/core_extensions/front_matter.rb:36:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/core_extensions/front_matter.rb:36:in `manipulate_resource_list'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/store.rb:234:in `block (4 levels) in ensure_resource_list_updated!'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.7/lib/active_support/notifications.rb:166:in `instrument'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/util.rb:21:in `instrument'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/store.rb:232:in `block (3 levels) in ensure_resource_list_updated!'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `traverse_depth_first'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:431:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/store.rb:231:in `block (2 levels) in ensure_resource_list_updated!'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.7/lib/active_support/notifications.rb:166:in `instrument'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/util.rb:21:in `instrument'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/store.rb:224:in `block in ensure_resource_list_updated!'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/store.rb:221:in `ensure_resource_list_updated!'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sitemap/extensions/on_disk.rb:51:in `update_files'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sources.rb:366:in `call'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sources.rb:366:in `block in run_callbacks'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `traverse_depth_first'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:431:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sources.rb:359:in `run_callbacks'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sources.rb:349:in `did_change'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/callback_manager.rb:57:in `instance_exec'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/callback_manager.rb:57:in `block in execute'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `traverse_depth_first'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/hamster-3.0.0/lib/hamster/vector.rb:431:in `each'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/callback_manager.rb:57:in `execute'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/callback_manager.rb:28:in `block in install_methods!'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sources/source_watcher.rb:279:in `update'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/middleman-core-4.1.10/lib/middleman-core/sources/source_watcher.rb:243:in `on_listener_change'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/config.rb:23:in `call'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/config.rb:23:in `call'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/processor.rb:115:in `_process_changes'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/processor.rb:19:in `block in loop_for'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/processor.rb:15:in `loop'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/processor.rb:15:in `loop_for'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/loop.rb:84:in `_wait_for_changes'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/event/loop.rb:42:in `block in setup'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/internals/thread_pool.rb:6:in `call'
 -- /Users/killerrobot/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/listen-3.0.8/lib/listen/internals/thread_pool.rb:6:in `block in add'

Additional information

  • Ruby version: 2.2.4
  • Middleman version: 4.1.10
  • OS version: MacOS X
@tdreyno

This comment has been minimized.

Copy link
Member

@tdreyno tdreyno commented Feb 15, 2017

I don't believe the file change watcher we use (listen) works very well with symlinks.

However, Middleman has a built-in feature for combining different paths on disk into a single site:

files.watch :source,
    path: File.expand_path("~/Dropbox/Geschäft/hyphenated-domain.com/images"),
    destination_dir: "images",
    frontmatter: false,
    binary: true

You can omit frontmatter and binary, but if everything in that folder is just images, that can speed things up.

@yas4891

This comment has been minimized.

Copy link
Author

@yas4891 yas4891 commented Feb 16, 2017

@tdreyno Thanks a lot, Thomas. That fixes the problem for me.
I'm leaving it up to the contributors to close this issue (it's a bug).

@raido

This comment has been minimized.

Copy link

@raido raido commented Mar 1, 2017

I got the same issue but I did not happen for weeks and now all of the sudden. It started to happen for me after activating few external_pipelines. I have to confirm if I disable these, it will resolve.

Edit: Did not solve the problem. It seems it fails if directories are symlinked, individual files work fine. I still have them in the project.

@motevets

This comment has been minimized.

Copy link
Contributor

@motevets motevets commented Aug 7, 2018

Sorry to revive an old thread...

@tdreyno we are running into this issue in our middleman project, but we're not sure where to put this files.watch configuration, and we don't see anything in the docs that reference it. Could you point us to some documentation that describes how to use this feature?

@tekmosis

This comment has been minimized.

Copy link

@tekmosis tekmosis commented Oct 4, 2018

@tdreyno any update on where to put that files.watch?

@motevets

This comment has been minimized.

Copy link
Contributor

@motevets motevets commented Oct 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.