On my M2 Macbook Pro 16-inch, 2023
I have a Dockerized rails app that worked until i updated my Mac Operating System to 13.4.1 (c) (22F770820d).
Now when i load a page on development my re-built and deployed app container, it shuts down with the output:
2023-07-24 16:03:33 (0.1ms) SELECT pg_try_advisory_lock(3213395767516697805);
2023-07-24 16:03:33 ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
2023-07-24 16:03:33 ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]
2023-07-24 16:03:33 (0.1ms) BEGIN
2023-07-24 16:03:33 (0.1ms) COMMIT
2023-07-24 16:03:33 (0.1ms) SELECT pg_advisory_unlock(3213395767516697805)
2023-07-24 16:03:33 ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2023-07-24 16:03:36 *** stack smashing detected ***: /usr/local/bundle/bin/rake assets:precompile terminated
2023-07-24 16:03:36 ./entrypoint.sh: line 5: 17 Aborted bundle exec rake assets:precompile
2023-07-24 16:03:36 Puma starting in single mode...
2023-07-24 16:03:36 * Version 3.12.1 (ruby 2.5.1-p57), codename: Llamas in Pajamas
2023-07-24 16:03:36 * Min threads: 5, max threads: 5
2023-07-24 16:03:36 * Environment: development
2023-07-24 16:03:38 * Listening on tcp://0.0.0.0:3000
2023-07-24 16:03:38 Use Ctrl-C to stop
2023-07-24 16:03:44 Started GET "/" for 10.0.0.2 at 2023-07-24 16:03:44 -0400
2023-07-24 16:03:44 Cannot render console from 10.0.0.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
2023-07-24 16:03:44 ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2023-07-24 16:03:44 Processing by PagesController#splash as HTML
2023-07-24 16:03:44 Rendering pages/splash.haml within layouts/application
2023-07-24 16:03:44 *** stack smashing detected ***: puma 3.12.1 (tcp://0.0.0.0:3000) [app] terminated
2023-07-24 16:03:44 ./entrypoint.sh: line 11: 29 Aborted bundle exec puma -C config/puma.rb
I have tried uping the docker resources to astronomical numbers with no luck. Here are some of my key docker files:
docker-compose.local.yml:
version: '3.7'
services:
web:
image: game-fuse_web
build:
context: .
dockerfile: ./Dockerfile.web.local
restart: always
depends_on:
- app
volumes:
- '.:/var/www/game-fuse-ast'
ports:
- 80:80
db:
image: postgres:9.6-bullseye
env_file:
- .env
volumes:
- "db:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_DB=game-fuse_development
ports:
- "5432:5432"
app:
stdin_open: true
tty: true
image: game-fuse_app
build:
context: .
dockerfile: ./Dockerfile.local
command: ./entrypoint.sh
volumes:
- .:/app
ports:
- 3000:3000
working_dir: /app
depends_on:
- db
volumes:
db:
Dockerfile.local:
FROM ruby:2.5.1-slim
ENV TZ=America/New_York
# Allow recently archived stretch to be accessed
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list &&
sed -i 's/deb.debian.org/debian.osuosl.org/g' /etc/apt/sources.list &&
sed -i 's/security.debian.org/debian.osuosl.org/g' /etc/apt/sources.list
RUN apt-get update -qq && apt-get install -y build-essential cron libpq-dev nodejs git
RUN gem install nokogiri -v 1.12.5
RUN gem install net-protocol -v 0.1.2
RUN gem install net-smtp -v 0.3.0
RUN gem install net-imap -v 0.2.2
#RUN gem install -N rails
# Set an environment variable where the Rails app is installed to inside of Docker image
ENV RAILS_ROOT /var/www/game-fuse
RUN mkdir -p $RAILS_ROOT
# Set working directory
WORKDIR $RAILS_ROOT
# Setting env up
ENV RAILS_ENV='development'
ENV RACK_ENV='development'
# Remove reliance on git:// protocol
RUN git config --global url."https://".insteadOf git://
# Adding gems
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
COPY config ./config
# Adding project files
RUN gem install bundler -v 2.3.26
RUN bundle install --jobs 20 --retry 5
RUN cd $RAILS_ROOT && bundle exec whenever --update-crontab
entrypoint.sh:
#!/bin/bash
bundle exec rake db:migrate
bundle exec rake assets:precompile
#bundle exec whenever --update-crontab
#cron
bundle exec puma -C config/puma.rb
Not really sure where to look and not a lot of results for this error on the internet in the context of Ruby on Rails or Docker.
2
Answers
The error "stack smashing detected" is an indication of a stack buffer overflow or some form of memory corruption.
As you already tried increasing the allocated resources, you might wanna randomly check if Rails, Ruby the gems in your docker container are compatible with the updates OS. Or you can try updating the Ruby/Rails/Gems in the Dockerfile
then do
docker-compose build
and re run the rails app."Stack smashing detected" is an indicator that puma is running into a buffer overflow, and the program is protecting you from data leakage/corruption. This is likely coming from the compiled Puma binary extension, and is not coming from Ruby or Rails.
3.12.1 is a very old version of Puma; I would suggest you try updating it first.