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

Error using webpacker:compile #1754

Closed
petenorth opened this issue Sep 28, 2019 · 9 comments
Closed

Error using webpacker:compile #1754

petenorth opened this issue Sep 28, 2019 · 9 comments
Assignees
Milestone

Comments

@petenorth
Copy link

So I am trying to get an asset pipeline working in a Rails app. My Dockerfile looks like

FROM oracle/graalvm-ce
  
ENV RAILS_ENV=production \
    NODE_ENV=production \
    RAILS_SERVE_STATIC_FILES=true \
    RAILS_LOG_TO_STDOUT=true \
    RACK_TIMEOUT_SERVICE_TIMEOUT=60 \
    BUNDLE_SILENCE_ROOT_WARNING=1

RUN yum -y install git libxml2-devel libxslt-devel postgresql-devel
RUN gu install ruby
RUN /opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/truffle/post_install_hook.sh

COPY Gemfile Gemfile.lock ./

RUN bundle install

RUN mkdir /app
WORKDIR /app

EXPOSE 3000

ENV PATH=/opt/graalvm-ce-19.2.0.1/bin:$PATH

ENTRYPOINT ["bundle", "exec"]
CMD ["rails", "server" ]

ENV PATH=/opt/graalvm-ce-19.2.0.1/jre/languages/js/bin:$PATH
RUN npm install yarn -g
COPY package.json yarn.lock ./
RUN yarn install && yarn cache clean

COPY . .

RUN bundle exec rake assets:precompile SECRET_KEY_BASE=stubbed SKIP_REDIS=true --trace

# Create symlinks for CSS files without digest hashes for use in error pages
RUN bundle exec rake assets:symlink_non_digested SECRET_KEY_BASE=stubbed SKIP_REDIS=true

The result is below, I have seen a fair amount of chat on spawn option: chdir . Is this something that is likely to be fixed in the near term or is it further out?

 ---> Running in fb1277f87d39
RubyDep: WARNING: Your Ruby may not be supported.
RubyDep: WARNING: Your Ruby is: 2.6.2 'truffleruby' (unrecognized). If you need this version supported, please open an issue at http://github.com/e2/ruby_dep
RubyDep: WARNING: (To disable warnings, see:http://github.com/e2/ruby_dep/wiki/Disabling-warnings )
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
I, [2019-09-28T12:16:16.942000 #1]  INFO -- : Raven 2.11.1 configured not to capture errors: DSN not set
** Invoke yarn:install (first_time)
** Execute yarn:install
** Execute assets:precompile
I, [2019-09-28T12:16:30.324000 #1]  INFO -- : Writing /app/public/assets/favicon-6921a31b023a41929073393bdad00077436c3835994079bcd2e437261875b2fc.ico
I, [2019-09-28T12:16:30.337000 #1]  INFO -- : Writing /app/public/assets/favicon-6921a31b023a41929073393bdad00077436c3835994079bcd2e437261875b2fc.ico.gz
I, [2019-09-28T12:16:30.650000 #1]  INFO -- : Writing /app/public/assets/govuk-mask-icon-de738c3fcce8ce2a91b67e89787090dc24a5cda0275ab6b75f6226c5b9619d3d.svg
I, [2019-09-28T12:16:30.653000 #1]  INFO -- : Writing /app/public/assets/govuk-mask-icon-de738c3fcce8ce2a91b67e89787090dc24a5cda0275ab6b75f6226c5b9619d3d.svg.gz
I, [2019-09-28T12:16:30.704000 #1]  INFO -- : Writing /app/public/assets/govuk-apple-touch-icon-180x180-ea1cbb1cbbeddfff275dfa6e8e46b84cd530892df79dc4882a8f99b802b49a90.png
I, [2019-09-28T12:16:30.747000 #1]  INFO -- : Writing /app/public/assets/govuk-apple-touch-icon-167x167-181e404a50c572923285fb83f0fbd78da6b4e38e3ce52f8e6b8e29da8586450a.png
I, [2019-09-28T12:16:30.792000 #1]  INFO -- : Writing /app/public/assets/govuk-apple-touch-icon-152x152-02457fcdcee8d309276305af2233d41bfb8fd055e855727d355e61bce7ffa9bb.png
I, [2019-09-28T12:16:30.840000 #1]  INFO -- : Writing /app/public/assets/govuk-apple-touch-icon-a318f305290c523aed80082456175b46c95350c0eeac93f42e78a71c7a55544e.png
I, [2019-09-28T12:16:30.890000 #1]  INFO -- : Writing /app/public/assets/govuk-opengraph-image-a1f7d89ffd0782738b1aeb0da37842d8bd0addbd724b8e58c3edbc7287cc11de.png
I, [2019-09-28T12:16:30.929000 #1]  INFO -- : Writing /app/public/assets/govuk-logotype-crown-0cdbde943be3a6518a5d7c00b607d134f4d5e3d0e8c68a1bfa2dc81f1f3edc4e.png
I, [2019-09-28T12:16:30.977000 #1]  INFO -- : Writing /app/public/assets/govuk-crest-2x-c6548884b516041752fc4156a50f084ca387b1e37e4f4668cd109058d924b197.png
I, [2019-09-28T12:16:31.029000 #1]  INFO -- : Writing /app/public/assets/collapsible-toggle-sprite-a2df0d42ea19774362db5a80ba83abf451ead181c8d6a605f9c5d8ef6b210928.png
I, [2019-09-28T12:16:31.063000 #1]  INFO -- : Writing /app/public/assets/disability-confident-small-8426debc6e145b637435047af839871c550fecc7e53127ecd5080eec8d4edd93.png
I, [2019-09-28T12:16:31.110000 #1]  INFO -- : Writing /app/public/assets/icon-pointer--blue-9e36e8b186b990289d4097220db0376f9b9029dd5303b4618544f3d553b71ab7.png
I, [2019-09-28T12:17:17.856000 #1]  INFO -- : Writing /app/public/assets/application-60760aa354cef52a4c89b9aae9916a1b40785671465c1b3891cc73d0fd52b1e8.css
I, [2019-09-28T12:17:17.859000 #1]  INFO -- : Writing /app/public/assets/application-60760aa354cef52a4c89b9aae9916a1b40785671465c1b3891cc73d0fd52b1e8.css.gz
I, [2019-09-28T12:17:18.049000 #1]  INFO -- : Writing /app/public/assets/light-94a07e06a1-v2-eedfb3c2f7945caebd0b15522b59d6c7f01be17fecd6102fd76452ad4042f7b0.woff2
I, [2019-09-28T12:17:18.064000 #1]  INFO -- : Writing /app/public/assets/light-f591b13f7d-v2-091aa3008e57dfeea899e33243c1d4ea95bab658f1cc2191679193bcbfac0b7b.woff
I, [2019-09-28T12:17:18.074000 #1]  INFO -- : Writing /app/public/assets/bold-b542beb274-v2-06eba01b1af0f4014b484c711771fef1db30becbf0edf481498da1e4958d3d47.woff2
I, [2019-09-28T12:17:18.082000 #1]  INFO -- : Writing /app/public/assets/bold-affa96571d-v2-5a2a925237869837d1afdd0a70ffded0717296d2d25885865d19c0da7f3ece5d.woff
I, [2019-09-28T12:17:18.097000 #1]  INFO -- : Writing /app/public/assets/govuk-crest-bb9e22aff7881b895c2ceb41d9340804451c474b883f09fe1b4026e76456f44b.png
** Invoke webpacker:compile (first_time)
** Invoke webpacker:verify_install (first_time)
** Invoke webpacker:check_node (first_time)
** Execute webpacker:check_node
** Invoke webpacker:check_yarn (first_time)
** Execute webpacker:check_yarn
** Invoke webpacker:check_binstubs (first_time)
** Execute webpacker:check_binstubs
** Execute webpacker:verify_install
** Invoke environment 
** Execute webpacker:compile
Compiling…
rake aborted!
Unknown spawn option: chdir
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `block in posix_spawnp'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `each_pair'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `posix_spawnp'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `spawn'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `spawn'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `spawn'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `spawn'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:213:in `popen_run'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:101:in `popen3'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/open3.rb:281:in `capture3'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/webpacker/compiler.rb:61:in `run_webpack'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/webpacker/compiler.rb:21:in `compile'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/webpacker/commands.rb:18:in `compile'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `compile'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:31:in `block (4 levels) in <top (required)>'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:6:in `ensure_log_goes_to_stdout'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:30:in `block (3 levels) in <top (required)>'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/webpacker.rb:20:in `with_node_env'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:29:in `block (2 levels) in <top (required)>'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `call'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/monitor.rb:230:in `mon_synchronize'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/webpacker-4.0.7/lib/tasks/webpacker/compile.rake:22:in `block in enhance_assets_precompile'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `call'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/monitor.rb:230:in `mon_synchronize'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:160:in `invoke_task'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:116:in `each'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:83:in `block in run'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/gems/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/opt/graalvm-ce-19.2.0.1/bin/rake:23:in `load'
/opt/graalvm-ce-19.2.0.1/bin/rake:23:in `load'
/opt/graalvm-ce-19.2.0.1/bin/rake:23:in `<top (required)>'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli/exec.rb:74:in `load'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli/exec.rb:74:in `load'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli/exec.rb:74:in `kernel_load'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli/exec.rb:28:in `run'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli.rb:463:in `exec'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli.rb:27:in `dispatch'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/cli.rb:18:in `start'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/bin/bundle:48:in `block in <main>'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/lib/mri/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/opt/graalvm-ce-19.2.0.1/jre/languages/ruby/bin/bundle:40:in `<main>'
Tasks: TOP => webpacker:compile
The command '/bin/sh -c bundle exec rake assets:precompile SECRET_KEY_BASE=stubbed SKIP_REDIS=true --trace' returned a non-zero code: 1```


@eregon
Copy link
Member

eregon commented Sep 28, 2019

Thank you for the report.

Unknown spawn option: chdir

I fixed this on master (#1739 (comment)), but it's not yet in a release.

@eregon eregon self-assigned this Sep 28, 2019
@eregon eregon added this to the 19.3.0 milestone Sep 28, 2019
@petenorth
Copy link
Author

#1739 mentions something similar and there is a link to some test(?) tags

fails:Process.spawn when passed :chdir changes to the directory passed for :chdir
fails:Process.spawn when passed :chdir calls #to_path to convert the :chdir value

which interestingly are not indicated as failing on master (or am I misinterpreting?)

https://github.com/oracle/truffleruby/blob/master/spec/tags/core/process/spawn_tags.txt

I am on 19.2.0.1 which does show them as failing

https://github.com/oracle/truffleruby/blob/release/graal-vm/19.2.0.1/spec/tags/core/process/spawn_tags.txt#77-78

@petenorth
Copy link
Author

@eregon you were already on it!

@eregon
Copy link
Member

eregon commented Oct 22, 2019

This should be fixed in the next release, 19.3.0.
I'll close this issue for now and ping you when 19.3.0 is released to verify the fix.
Thank you for the bug report.

@eregon eregon closed this as completed Oct 22, 2019
@eregon
Copy link
Member

eregon commented Nov 22, 2019

@petenorth TruffleRuby 19.3.0 was released, could you verify it works now?

@petenorth
Copy link
Author

Have been looking at this but with the original test I think it is hitting a memory issue in ** Execute webpacker:compile

The following works without issue (the trivial app generated by rails)

FROM oracle/graalvm-ce:19.3.0
  
ENV RAILS_ENV=production \
    NODE_ENV=production \
    RAILS_SERVE_STATIC_FILES=true \
    RAILS_LOG_TO_STDOUT=true \
    RACK_TIMEOUT_SERVICE_TIMEOUT=60 \
    BUNDLE_SILENCE_ROOT_WARNING=1

RUN yum -y install git libxml2-devel libxslt-devel sqlite-devel
RUN gu install ruby
RUN /opt/graalvm-ce-java8-19.3.0/jre/languages/ruby/lib/truffle/post_install_hook.sh

RUN gem install rails --version 5.2.3
ENV PATH=/opt/graalvm-ce-java8-19.3.0/jre/languages/ruby/bin:$PATH

ENV PATH=/opt/graalvm-ce-java8-19.3.0/jre/languages/js/bin:$PATH
RUN npm install yarn -g

RUN rails --version
RUN rails new blog --skip-bundle

WORKDIR /blog

RUN bundle install --without development

EXPOSE 3000

ENV PATH=/opt/graalvm-ce-java8-19.3.0/bin:$PATH
ENTRYPOINT ["bundle", "exec"]
CMD ["rails", "server" ]

RUN bundle exec rake assets:precompile  --trace

with the original test (with the more complex application )

I sometimes get

** Execute webpacker:compile
Compiling…
Compilation failed:
internal/child_process.js:810
        const ex = errnoException(err, 'write');
                   ^

Error: write EPIPE
    at process._send (internal/child_process.js:810:20)
    at process.send (internal/child_process.js:680:19)
    at callback (/app/node_modules/worker-farm/lib/child/index.js:32:17)
    at /app/node_modules/terser-webpack-plugin/dist/worker.js:13:5
    at handle (/app/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/app/node_modules/worker-farm/lib/child/index.js:55:3)
    at process.emit (events.js:209:13)
    at emit (internal/child_process.js:880:12)
    at process.processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on process instance at:
    at internal/child_process.js:814:39
    at process.processTicksAndRejections (internal/process/task_queues.js:75:11) {
  errno: 'EPIPE',
  code: 'EPIPE',
  syscall: 'write'
}

or just a docker error of 137 (which suggests memory). I'll try outside of Docker on the original test.

@petenorth
Copy link
Author

I have run it outside of Docker on the complex app and it succeeds:

** Invoke webpacker:compile (first_time)
** Invoke webpacker:verify_install (first_time)
** Invoke webpacker:check_node (first_time)
** Execute webpacker:check_node
** Invoke webpacker:check_yarn (first_time)
** Execute webpacker:check_yarn
** Invoke webpacker:check_binstubs (first_time)
** Execute webpacker:check_binstubs
** Execute webpacker:verify_install
** Invoke environment 
** Execute webpacker:compile
Compiling…
Compiled all packs in /Users/..../public/packs

@eregon
Copy link
Member

eregon commented Nov 25, 2019

@petenorth Thanks for checking. It seems indeed that webpacker:compile uses too much memory on TruffleRuby.
Could you report it as a separate bug if you think it's using too much compared to MRI?
Good to hear it works outside Docker :)

@petenorth
Copy link
Author

petenorth commented Nov 25, 2019

I managed to get the docker build working, not entirely sure what did it but

  • --memory=4096m as a flag on the docker build command made no difference
  • instead I changed the memory available to Docker desktop on my mac to 4GB (from 3GB) via the preferences menu and restarted, the docker build then completed.

I think the memory usage is slightly more for TruffleRuby but not massively so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants