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

Errno::ESPIPE Illegal seek -- Docker container errrors #2034

Closed
andrewsheelan opened this issue Jun 12, 2020 · 22 comments
Closed

Errno::ESPIPE Illegal seek -- Docker container errrors #2034

andrewsheelan opened this issue Jun 12, 2020 · 22 comments
Assignees
Labels
Milestone

Comments

@andrewsheelan
Copy link

Am trying to truffleruby convert - my dockerized rails enviroment

Here's my new Dockerfile with verbose enabled:

Dockerfile

# Builder image which needs dev tools to run post_install_hook.sh
FROM oraclelinux:7-slim AS builder

ARG GRAALVM_VERSION=20.1.0
ARG TRUFFLERUBY_PKG=https://github.com/oracle/truffleruby/releases/download/vm-$GRAALVM_VERSION/truffleruby-$GRAALVM_VERSION-linux-amd64.tar.gz

RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash -
RUN yum update -y oraclelinux-release-el7 \
    && yum install -y curl tar gzip zlib openssl-devel gcc make git postgresql-devel icu libicu-devel nodejs\
    && rm -rf /var/cache/yum

RUN curl --fail --location --retry 3 ${TRUFFLERUBY_PKG} | tar xz -C /opt

ENV LANG=en_US.UTF-8 \
    PATH=/opt/truffleruby-$GRAALVM_VERSION-linux-amd64/bin:$PATH

RUN /opt/truffleruby-$GRAALVM_VERSION-linux-amd64/lib/truffle/post_install_hook.sh

# TODO: add commands to install gems here
RUN gem install bundler:2.1.4

COPY Gemfile Gemfile.lock ./
RUN bundle install --verbose --no-cache
# Resulting slim image without dev tools
FROM oraclelinux:7-slim

ARG GRAALVM_VERSION=20.1.0

RUN yum update -y oraclelinux-release-el7 \
    && yum install -y zlib openssl git  nodejs postgresql-dev git icu-dev\
    && rm -rf /var/cache/yum

COPY --from=builder /opt/truffleruby-$GRAALVM_VERSION-linux-amd64 /opt/truffleruby-$GRAALVM_VERSION-linux-amd64

ENV LANG=en_US.UTF-8 \
    PATH=/opt/truffleruby-$GRAALVM_VERSION-linux-amd64/bin:$PATH

WORKDIR /app

COPY . .

RUN echo "gem: --no-document" > ~/.gemrc

CMD puma -C config/puma.rb

Here's the error am receiving:

Retrying fetcher due to error (2/4): Errno::ESPIPE Illegal seek
Retrying fetcher due to error (3/4): Errno::ESPIPE Illegal seek
Retrying fetcher due to error (4/4): Errno::ESPIPE Illegal seek
/opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `handle': Illegal seek (Errno::ESPIPE)
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `block in unseek!'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `synchronized'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `unseek!'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `reset_buffering'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `write'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `block in print'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `each'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `print'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `print'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/shell/basic.rb:100:in `say'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:101:in `tell_me'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:45:in `debug'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher/base.rb:45:in `log_specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher/compact_index.rb:40:in `specs_for_names'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher/compact_index.rb:30:in `specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher/compact_index.rb:16:in `call'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher/compact_index.rb:16:in `specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher.rb:133:in `block in specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher.rb:132:in `each'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher.rb:132:in `specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher.rb:117:in `block in specs_with_retry'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/retry.rb:40:in `call'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/retry.rb:40:in `run'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/retry.rb:30:in `attempt'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/fetcher.rb:116:in `specs_with_retry'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/source/rubygems.rb:413:in `block in fetch_names'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/source/rubygems.rb:410:in `each'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/source/rubygems.rb:410:in `fetch_names'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/source/rubygems.rb:405:in `block in remote_specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/index.rb:11:in `build'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/source/rubygems.rb:392:in `remote_specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/source/rubygems.rb:88:in `specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:273:in `block (2 levels) in index'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:271:in `each'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:271:in `block in index'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/index.rb:11:in `build'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:268:in `index'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:258:in `resolve'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/definition.rb:158:in `resolve_remotely!'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/installer.rb:303:in `resolve_if_needed'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/installer.rb:84:in `block in run'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/process_lock.rb:12:in `block in lock'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/process_lock.rb:9:in `open'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/process_lock.rb:9:in `lock'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/installer.rb:73:in `run'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/installer.rb:25:in `install'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/cli/install.rb:66:in `run'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/cli.rb:256:in `block in install'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/settings.rb:124:in `temporary'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/cli.rb:255:in `install'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
	from /opt/truffleruby-20.1.0-linux-amd64/lib/gems/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
	from /opt/truffleruby-20.1.0-linux-amd64/bin/bundle:23:in `load'
	from /opt/truffleruby-20.1.0-linux-amd64/bin/bundle:23:in `load'
	from /opt/truffleruby-20.1.0-linux-amd64/bin/bundle:23:in `<main>'
PrintGCSummary: YoungGenerationSize: 268435456
PrintGCSummary: MinimumHeapSize: 536870912
PrintGCSummary: MaximumHeapSize: 3221225472
PrintGCSummary: AlignedChunkSize: 1048576
PrintGCSummary: CollectedTotalChunkBytes: 23897120712
PrintGCSummary: CollectedTotalObjectBytes: 23499840032
PrintGCSummary: AllocatedNormalChunkBytes: 24518020664
PrintGCSummary: AllocatedNormalObjectBytes: 24085649032
PrintGCSummary: IncrementalGCCount: 75
PrintGCSummary: IncrementalGCNanos: 4210138200
PrintGCSummary: CompleteGCCount: 15
PrintGCSummary: CompleteGCNanos: 4154855900
PrintGCSummary: GCNanos: 8364994100
PrintGCSummary: TotalNanos: 29071609400
PrintGCSummary: GCLoadPercent: 29
@eregon eregon self-assigned this Jun 12, 2020
@ssnickolay
Copy link
Collaborator

ssnickolay commented Jun 13, 2020

Hi @andrewsheelan! Can you try to build truffleruby and your rails app on top of Debian image? Also, please don't use multi-stage builds (until we find out the cause of the original issue) in order to avoid problems with data reusing.

Dockerfile:

FROM debian

RUN apt-get update

RUN apt-get install -y locales

RUN dpkg-reconfigure locales

ENV LANG=en_US.UTF-8 \
    LANGUAGE=en_US:en \
    LC_ALL=en_US.UTF-8

RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
RUN echo "LANG=en_US.UTF-8" >> /etc/locale.conf
RUN locale-gen en_US.UTF-8

RUN apt-get install -y vim

ARG GRAAL_VERSION
ARG JDK_VERSION

RUN set -xeu && \
    export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
        ca-certificates `# stays, not having this is just not useful` \
        curl \
        && \
    mkdir /graalvm && \
    curl -fsSL "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${GRAAL_VERSION}/graalvm-ce-${JDK_VERSION}-linux-amd64-${GRAAL_VERSION}.tar.gz" \
        | tar -zxC /graalvm --strip-components 1 && \
    find /graalvm -name "*src.zip"  -printf "Deleting %p\n" -exec rm {} + && \
    { test ! -d /graalvm/legal || tar czf /graalvm/legal.tgz /graalvm/legal/; } && \
    { test ! -d /graalvm/legal || rm -r /graalvm/legal; } && \
    rm -rf /graalvm/man `# does not exist in java11 package` && \
    echo Cleaning up... && \
    apt-get remove -y \
        curl \
        && \
    apt-get autoremove -y && \
    apt-get clean && rm -r "/var/lib/apt/lists"/* && \
    echo 'PATH="/graalvm/bin:$PATH"' | install --mode 0644 /dev/stdin /etc/profile.d/graal-on-path.sh && \
    echo OK

# This applies to all container processes. However, `bash -l` will source `/etc/profile` and set $PATH on its own. For this reason, we
# *also* set $PATH in /etc/profile.d/*

# Maven and GraalVM settings
RUN apt-get update
RUN apt-get install -y wget unzip

RUN wget http://us.mirrors.quenda.co/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip
RUN unzip apache-maven-3.6.3-bin.zip

ENV PATH=/apache-maven-3.6.3/bin:/graalvm/bin:$PATH

# truffleruby deps & setup
RUN apt-get update
RUN apt-get install -y make gcc libssl-dev libz-dev
RUN gu install ruby
RUN /graalvm/languages/ruby/lib/truffle/post_install_hook.sh

RUN mkdir /app

RUN gem install bundler -v '~> 2'

RUN apt-get install -y git
RUN apt-get install -y sqlite3 libsqlite3-dev

WORKDIR /app

and docker-compose.yml (if you use it):

version: '3.4'
services:
  graalvm: &graalvm
    image: graalvm:0.0.1-dev
    build:
      context: .
      dockerfile: ./Dockerfile
      args:
        - GRAAL_VERSION=20.1.0
        - JDK_VERSION=java11
    volumes:
      - .:/app:cached
      - bundle:/bundle
      - ~/.ssh:/root/.ssh:ro
    tmpfs:
      - /tmp
    environment:
      - BUNDLE_PATH=/bundle
      - HISTFILE=/bundle/.bash_history
      - PRY_HISTFILE=/bundle/.pry_history
      - JAVA_HOME=/graalvm
      - SL_BUILD_NATIVE=false
    networks:
      default:
    stdin_open: true
    tty: true
  runner:
    <<: *graalvm
    entrypoint: /bin/bash
volumes:
  bundle:
  graalvm:
networks:
  default:

@andrewsheelan
Copy link
Author

@ssnickolay still seeing the same error when I do a bundle install

@ssnickolay
Copy link
Collaborator

@andrewsheelan is this error happen in the beginning of bundle execution or with particular gem installation?

@andrewsheelan
Copy link
Author

@ssnickolay this happens pretty randomly while fetching gem metadata and looking up gems so yeah in the beginning of bundle execution. Individual gem installations works fine.
Also without verbose its hard to trace, it just kills the build without showing the reason, almost like it's running out of resources or something.

@ssnickolay
Copy link
Collaborator

@andrewsheelan can you share your Gemfile and Gemfile.lock please? I'll try myself

@andrewsheelan
Copy link
Author

Gemfile

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.1'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (6.0.3.1)
      actionpack (= 6.0.3.1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (6.0.3.1)
      actionpack (= 6.0.3.1)
      activejob (= 6.0.3.1)
      activerecord (= 6.0.3.1)
      activestorage (= 6.0.3.1)
      activesupport (= 6.0.3.1)
      mail (>= 2.7.1)
    actionmailer (6.0.3.1)
      actionpack (= 6.0.3.1)
      actionview (= 6.0.3.1)
      activejob (= 6.0.3.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (6.0.3.1)
      actionview (= 6.0.3.1)
      activesupport (= 6.0.3.1)
      rack (~> 2.0, >= 2.0.8)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (6.0.3.1)
      actionpack (= 6.0.3.1)
      activerecord (= 6.0.3.1)
      activestorage (= 6.0.3.1)
      activesupport (= 6.0.3.1)
      nokogiri (>= 1.8.5)
    actionview (6.0.3.1)
      activesupport (= 6.0.3.1)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (6.0.3.1)
      activesupport (= 6.0.3.1)
      globalid (>= 0.3.6)
    activemodel (6.0.3.1)
      activesupport (= 6.0.3.1)
    activerecord (6.0.3.1)
      activemodel (= 6.0.3.1)
      activesupport (= 6.0.3.1)
    activestorage (6.0.3.1)
      actionpack (= 6.0.3.1)
      activejob (= 6.0.3.1)
      activerecord (= 6.0.3.1)
      marcel (~> 0.3.1)
    activesupport (6.0.3.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
      zeitwerk (~> 2.2, >= 2.2.2)
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    bindex (0.8.1)
    bootsnap (1.4.6)
      msgpack (~> 1.0)
    builder (3.2.4)
    byebug (11.1.3)
    capybara (3.32.2)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (~> 1.5)
      xpath (~> 3.2)
    childprocess (3.0.0)
    concurrent-ruby (1.1.6)
    crass (1.0.6)
    erubi (1.9.0)
    ffi (1.13.1)
    globalid (0.4.2)
      activesupport (>= 4.2.0)
    i18n (1.8.3)
      concurrent-ruby (~> 1.0)
    jbuilder (2.10.0)
      activesupport (>= 5.0.0)
    listen (3.2.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    loofah (2.5.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (1.0.0)
    mimemagic (0.3.5)
    mini_mime (1.0.2)
    mini_portile2 (2.4.0)
    minitest (5.14.1)
    msgpack (1.3.3)
    nio4r (2.5.2)
    nokogiri (1.10.9)
      mini_portile2 (~> 2.4.0)
    pg (1.2.3)
    public_suffix (4.0.5)
    puma (4.3.5)
      nio4r (~> 2.0)
    rack (2.2.2)
    rack-proxy (0.6.5)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (6.0.3.1)
      actioncable (= 6.0.3.1)
      actionmailbox (= 6.0.3.1)
      actionmailer (= 6.0.3.1)
      actionpack (= 6.0.3.1)
      actiontext (= 6.0.3.1)
      actionview (= 6.0.3.1)
      activejob (= 6.0.3.1)
      activemodel (= 6.0.3.1)
      activerecord (= 6.0.3.1)
      activestorage (= 6.0.3.1)
      activesupport (= 6.0.3.1)
      bundler (>= 1.3.0)
      railties (= 6.0.3.1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (6.0.3.1)
      actionpack (= 6.0.3.1)
      activesupport (= 6.0.3.1)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.20.3, < 2.0)
    rake (13.0.1)
    rb-fsevent (0.10.4)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    regexp_parser (1.7.1)
    rubyzip (2.3.0)
    sass-rails (6.0.0)
      sassc-rails (~> 2.1, >= 2.1.1)
    sassc (2.4.0)
      ffi (~> 1.9)
    sassc-rails (2.1.2)
      railties (>= 4.0.0)
      sassc (>= 2.0)
      sprockets (> 3.0)
      sprockets-rails
      tilt
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    spring (2.1.0)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (4.0.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (1.0.1)
    thread_safe (0.3.6)
    tilt (2.0.10)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (1.2.7)
      thread_safe (~> 0.1)
    web-console (4.0.2)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webdrivers (4.4.1)
      nokogiri (~> 1.6)
      rubyzip (>= 1.3.0)
      selenium-webdriver (>= 3.0, < 4.0)
    webpacker (4.2.2)
      activesupport (>= 4.2)
      rack-proxy (>= 0.6.1)
      railties (>= 4.2)
    websocket-driver (0.7.2)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.3.0)

PLATFORMS
  ruby

DEPENDENCIES
  bootsnap (>= 1.4.2)
  byebug
  capybara (>= 2.15)
  jbuilder (~> 2.7)
  listen (~> 3.2)
  pg (>= 0.18, < 2.0)
  puma (~> 4.1)
  rails (~> 6.0.3, >= 6.0.3.1)
  sass-rails (>= 6)
  selenium-webdriver
  spring
  spring-watcher-listen (~> 2.0.0)
  turbolinks (~> 5)
  tzinfo-data
  web-console (>= 3.3.0)
  webdrivers
  webpacker (~> 4.0)

RUBY VERSION
   ruby 2.6.5p114

BUNDLED WITH
   1.17.2

@andrewsheelan
Copy link
Author

@ssnickolay attached.

@eregon
Copy link
Member

eregon commented Jun 15, 2020

Also without verbose its hard to trace, it just kills the build without showing the reason, almost like it's running out of resources or something.

That might be due to #1895 (fixed on master).

@ssnickolay
Copy link
Collaborator

ssnickolay commented Jun 15, 2020

I guess the main problem is #62

By steps (with my Drockerfile+ compose and andrewsheelan's Gemfile+lock):

  1. $ docker-compose build
  2. $ docker-compose run --rm runner
  3. $ export BUNDLE_PATH=/graalvm/languages/ruby/lib/gems // or delete the env from compose
  4. # create Gemfile & Gemfile.lock
  5. $ bundle install
    => 10+ gem successfully installed and failed because of nokogiri
  6. $ apt-get install libxslt-dev libxml2-dev zlib1g-dev build-essential patch ruby-dev zlib1g-dev liblzma-dev
  7. $ gem install nokogiri -v '1.10.9' -- --with-xml2-dir=/usr/include/libxml2 --with-xslt-dir=/usr/include/libxslt --with-exslt-dir=/usr/include/libexslt --with-xml2-include=/usr/include/libxml2
  8. bundle install
    => other 10+gems installed (nokogiri included) and failed because of pg build gem native extension.

I stopped the experiment since there are no truffleruby related problems (except nokogiri issue, but this is a common problem).

@eregon
Copy link
Member

eregon commented Jun 15, 2020

Nokogiri should work fine, I don't think it's the issue here.

There is a lseek() call here:

r = Truffle::POSIX.lseek(io.fileno, amount, IO::SEEK_CUR)

which seems to cause that Illegal seek (Errno::ESPIPE).

I'll try to reproduce. I tried outside Docker once but couldn't reproduce.

@eregon
Copy link
Member

eregon commented Jun 15, 2020

I've looked at this and it's a bit puzzling.
We only do lseek() if the buffer is write_synced? && !empty?, which seems impossible for an IO to which we only write like STDOUT.
If both reading and writing are mixed on the same IO, then it seems possible to happen.
Or maybe it's some kind of concurrency issue.

For now I've cleaned up code related to that to help make this error clearer.

@eregon eregon added the bug label Jun 15, 2020
@andrewsheelan
Copy link
Author

@eregon when this is ready I can pull the latest and re-run the test. Thanks.

@eregon
Copy link
Member

eregon commented Jun 16, 2020

762197b is the cleanup.
Feel free to retry with that and use truffleruby-head:
https://github.com/oracle/truffleruby/blob/master/doc/user/standalone-distribution.md#latest-nightly-build

I'd like to get #1414 fixed too so we get a more useful backtrace here, but not sure when that will be done.

@andrewsheelan
Copy link
Author

@eregon Pulled the latest and was able to build it. Thanks.
Here's the dockerfile I used.


FROM ubuntu:18.04
RUN apt-get update && apt-get install -y  \
            build-essential locales curl libssl-dev unzip git \
            libxml2-dev libxslt-dev libpq-dev nodejs && \
    rm -rf /var/lib/apt/lists/* && \
    localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

ENV LANG en_US.utf8

WORKDIR /app
RUN mkdir -p /app /graalvm

RUN curl -L https://github.com/ruby/truffleruby-dev-builder/releases/latest/download/truffleruby-head-ubuntu-18.04.tar.gz | tar -zxC /graalvm
ENV PATH="/graalvm/truffleruby-head/bin:$PATH"
RUN /graalvm/truffleruby-head/lib/truffle/post_install_hook.sh

RUN gem install bundler -v '~> 2'
COPY Gemfile .
RUN bundle install

COPY . .

CMD puma -C config/puma.rb

Am trying to do some performance comparisons. I did face issues when installing stackprof gem. Will do some more testing and keep you guys posted. For now we're good.

Also thanks to @ssnickolay . I'll use your dockerfile as well once we have the official release.

@eregon
Copy link
Member

eregon commented Jun 17, 2020

Thanks for checking. I'd like to close this issue since the bug seems resolved now.

@eregon
Copy link
Member

eregon commented Jul 4, 2020

This seems to happen again: #2012 (comment)

@eregon eregon reopened this Jul 4, 2020
@eregon
Copy link
Member

eregon commented Jul 20, 2020

@petenorth Could you tell me how to reproduce #2012 (comment) and try to run it that way again? That issue still exists, but rerunning should give more information due to the backtrace including the core libraries files now.

@petenorth
Copy link

@eregon I hacked an existing github workflow

https://github.com/petenorth/decimal-rounding-ruby/blob/master/.github/workflows/ruby.yml

    steps:
    - uses: actions/checkout@v2
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: truffleruby-head
    - run: gem install thor 

@petenorth
Copy link

Just kicked off another run and it seems to be fine

https://github.com/petenorth/decimal-rounding-ruby/runs/891326461?check_suite_focus=true

@eregon
Copy link
Member

eregon commented Jul 21, 2020

It seems transient (seemed to happen at different points in time in past reports, not always during installing the same gem) and probably needs to install many gems to increase the chance to hit I think.
If it's easy, could you try with a bigger gem file (e.g., some Rails app)?

@eregon eregon removed this from the 20.2.0 milestone Aug 19, 2020
@eregon
Copy link
Member

eregon commented Aug 29, 2020

Happened here too:
https://github.com/ruby-gettext/locale/runs/1043329608

##[group]Run bundle exec rake
�[36;1mbundle exec rake�[0m
shell: /bin/bash -e {0}
env:
  PATH: /Users/runner/.rubies/truffleruby-head/bin:/Users/runner/.cargo/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Users/runner/.yarn/bin:/usr/local/go/bin:/Users/runner/Library/Android/sdk/tools:/Users/runner/Library/Android/sdk/platform-tools:/Users/runner/Library/Android/sdk/ndk-bundle:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/bin:/bin:/usr/sbin:/sbin:/Users/runner/.dotnet/tools:/Users/runner/.ghcup/bin:/Users/runner/hostedtoolcache/stack/2.3.3/x64
##[endgroup]
/Users/runner/.rubies/truffleruby-head/bin/truffleruby test/run-test.rb
stty: stdin isn't a terminal
win32 test was skipped.
jruby test was skipped.
Loaded suite .
Started
...............................................................................
#<Thread:0xa588@/Users/runner/work/locale/locale/test/test_thread.rb:13 run> terminated with exception:
<internal:core> core/errno.rb:48:in `handle': Illegal seek (Errno::ESPIPE)
	from <internal:core> core/io.rb:246:in `block in unseek!'
	from <internal:core> core/io.rb:240:in `synchronized'
	from <internal:core> core/io.rb:240:in `unseek!'
	from <internal:core> core/io.rb:2140:in `reset_buffering'
	from <internal:core> core/io.rb:2463:in `write'
	from <internal:core> core/kernel.rb:472:in `block in print'
	from <internal:core> core/kernel.rb:471:in `each'
	from <internal:core> core/kernel.rb:471:in `print'
	from /Users/runner/work/locale/locale/test/test_thread.rb:21:in `block (2 levels) in invoke_thread'
	from /Users/runner/work/locale/locale/test/test_thread.rb:18:in `each'
	from /Users/runner/work/locale/locale/test/test_thread.rb:18:in `block in invoke_thread'
#<Thread:0xa5a8@/Users/runner/work/locale/locale/test/test_thread.rb:13 run> terminated with exception:
<internal:core> core/errno.rb:48:in `handle': Illegal seek (Errno::ESPIPE)
	from <internal:core> core/io.rb:246:in `block in unseek!'
	from <internal:core> core/io.rb:240:in `synchronized'
	from <internal:core> core/io.rb:240:in `unseek!'
	from <internal:core> core/io.rb:2140:in `reset_buffering'
	from <internal:core> core/io.rb:2463:in `write'
	from <internal:core> core/kernel.rb:472:in `block in print'
	from <internal:core> core/kernel.rb:471:in `each'
	from <internal:core> core/kernel.rb:471:in `print'
	from /Users/runner/work/locale/locale/test/test_thread.rb:21:in `block (2 levels) in invoke_thread'
	from /Users/runner/work/locale/locale/test/test_thread.rb:18:in `each'
	from /Users/runner/work/locale/locale/test/test_thread.rb:18:in `block in invoke_thread'
#<Thread:0xa5c8@/Users/runner/work/locale/locale/test/test_thread.rb:13 run> terminated with exception:
<internal:core> core/errno.rb:48:in `handle': Illegal seek (Errno::ESPIPE)
	from <internal:core> core/io.rb:246:in `block in unseek!'
	from <internal:core> core/io.rb:240:in `synchronized'
	from <internal:core> core/io.rb:240:in `unseek!'
	from <internal:core> core/io.rb:2140:in `reset_buffering'
	from <internal:core> core/io.rb:2463:in `write'
	from <internal:core> core/kernel.rb:472:in `block in print'
	from <internal:core> core/kernel.rb:471:in `each'
	from <internal:core> core/kernel.rb:471:in `print'
	from /Users/runner/work/locale/locale/test/test_thread.rb:21:in `block (2 levels) in invoke_thread'
	from /Users/runner/work/locale/locale/test/test_thread.rb:18:in `each'
	from /Users/runner/work/locale/locale/test/test_thread.rb:18:in `block in invoke_thread'
<internal:core> core/errno.rb:48:in `handle': Illegal seek (Errno::ESPIPE)
	from <internal:core> core/io.rb:246:in `block in unseek!'
	from <internal:core> core/io.rb:240:in `synchronized'
	from <internal:core> core/io.rb:240:in `unseek!'
	from <internal:core> core/io.rb:2140:in `reset_buffering'
	from <internal:core> core/io.rb:2463:in `write'
	from <internal:core> core/truffle/io_operations.rb:37:in `puts'
	from <internal:core> core/io.rb:1832:in `puts'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/console/testrunner.rb:465:in `output'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/console/testrunner.rb:459:in `nl'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/console/testrunner.rb:119:in `finished'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/console/testrunner.rb:114:in `finished'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/util/observable.rb:78:in `call'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/util/observable.rb:78:in `block in notify_listeners'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/util/observable.rb:78:in `each'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/util/observable.rb:78:in `notify_listeners'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/testrunnermediator.rb:50:in `run'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/testrunner.rb:40:in `start_mediator'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/testrunner.rb:25:in `start'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/ui/testrunnerutilities.rb:24:in `run'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/autorunner.rb:446:in `block in run'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/autorunner.rb:502:in `change_work_directory'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/autorunner.rb:445:in `run'
	from /Users/runner/.rubies/truffleruby-head/lib/gems/gems/test-unit-3.3.6/lib/test/unit/autorunner.rb:66:in `run'
	from test/run-test.rb:33:in `<main>'
rake aborted!

eregon added a commit to eregon/truffleruby that referenced this issue Aug 29, 2020
* The existing write buffering from Rubinius is buggy, complicated,
  and missing synchronization. Write buffering does not seem needed
  in Ruby (unlike read buffering). It also caused an extra copy of the bytes.
* Also makes it easier to reason about RDWR IOs since now there cannot
  be both directions using the same buffer.
* Ensure every usage of @ibuffer is guarded by #ensure_open_and_readable
  or handles @ibuffer being nil.
* Fixes oracle#2034
@eregon eregon added this to the 20.3.0 milestone Aug 31, 2020
@eregon eregon closed this as completed in 18089f0 Aug 31, 2020
eregon added a commit that referenced this issue Aug 31, 2020
@eregon
Copy link
Member

eregon commented Aug 31, 2020

This should be fixed by 18089f0, since it removes that entire code path.
I believe the original issue was missing synchronization in IO write buffering, where 2 concurrent write could end up seeing the intermediate states of the buffer.

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

No branches or pull requests

4 participants