middleman-sprockets
middleman-sprockets copied to clipboard
doesn't work with `mini_racer` gem
With therubyracer
it works fine, but not with mini_racer
gem. It 'freezes' and never finishes the build. mini_racer
works perfectly fine with rails sprockets.
What versions or Middleman, Middleman::Sprockets, Sprockets, and MiniRacer are you using?
I've set up a minimal app to do some testing, and found that there was a fix in MiniRacer 0.1.7 (that does affect us) to prevent hanging (https://github.com/discourse/mini_racer/blob/master/CHANGELOG#L3-L5). It'll take a bit more digging to figure out what's causing the issue, but hopefully updating MiniRacer fixes the issue for now?
@stevenosloan I was trying with "latest" everything. You can check the code here (it's open): https://gitlab.com/rubyonrails-brasil/rubyonrails-brasil.gitlab.io/blob/492de52acb399ff961954ae6a0c00f07aeef37d1/Gemfile
running it in "development" works, but running the build rake task doesn't.
(make sure you checkout the 492de52acb399ff961954ae6a0c00f07aeef37d1
commit, which is one before I changed from mini_racer
to therubyracer
so I can actually release the changes)
Ah great, thanks for that example.
Still need to do some digging to see if there's a fix, but it's looking like the Parallel
gem and MiniRacer
don't play nice and Parallel
hangs waiting for the process here. For now, if you add --no-parallel
to the build command, things won't lock up.
Here some logs from stuck parallel build:
== Instrument (sitemap.manipulator): 746.893ms
{:name=>:asset_hash}
== Running manipulator: sitemap_move_files (101)
== Running manipulator: collections (110)
== Running manipulator: routing (130)
== Instrument (sitemap.update): 2360.763ms
{:reasons=>[:touched_file, :registered_new_manipulator_front_matter, :registered_new_manipulator_sitemap_ondisk, :registered_new_manipulator_sitemap_import, :registered_new_manipulator_sitemap_endpoint, :registered_new_manipulator_sitemap_proxies, :registered_new_manipulator_sitemap_redirects, :registered_new_manipulator_sitemap_move_files, :registered_new_manipulator_sitemap_ignore, :registered_new_manipulator_routing, :registered_new_manipulator_collections, :first_run_change_ignore, :registered_new_manipulator_blog_blog1_articles, :registered_new_manipulator_blog_blog1_tags, :registered_new_manipulator_blog_blog1_calendar, :registered_new_manipulator_blog_blog1_paginate, :registered_new_manipulator_sprockets, :registered_new_manipulator_asset_hash]}
== Instrument (builder.setup): 2849.4359999999997ms
{}
== Instrument (builder.queue): 1263.3190000000002ms
{}
== Prerendering CSS
== Request: /css/ui-8cbf3345.css
== Request: /css/audio-08f55ab4.css
== Request: /css/application-8f6fedff.css
== Finishing Request: css/audio-08f55ab4.css (0.0s)
== Finishing Request: css/ui-8cbf3345.css (0.0s)
== Finishing Request: css/application-8f6fedff.css (0.0s)
identical build/css/audio-08f55ab4.css
== Instrument (builder.output.resource): 300.984ms
{:path=>"audio-08f55ab4.css"}
WARNING: V8 isolate was forked, it can not be disposed and memory will not be reclaimed till the Ruby process exits.
identical build/css/ui-8cbf3345.css
== Instrument (builder.output.resource): 336.295ms
{:path=>"ui-8cbf3345.css"}
identical build/css/application-8f6fedff.css
== Instrument (builder.output.resource): 342.215ms
{:path=>"application-8f6fedff.css"}
WARNING: V8 isolate was forked, it can not be disposed and memory will not be reclaimed till the Ruby process exits.
WARNING: V8 isolate was forked, it can not be disposed and memory will not be reclaimed till the Ruby process exits.
Ah great, thanks for that example.
Still need to do some digging to see if there's a fix, but it's looking like the
Parallel
gem andMiniRacer
don't play nice andParallel
hangs waiting for the process here. For now, if you add--no-parallel
to the build command, things won't lock up.
As of version 0.4.0, the mini_racer gem supports a new "single_threaded" flag that fixes this without the need to pass --no-parallel
to the build command. This can be set in the config.rb file:
MiniRacer::Platform.set_flags! :single_threaded