Skip to content

Image tag 3.2.2 Thread not permitted #429

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

Closed
psulightning opened this issue Sep 6, 2023 · 2 comments
Closed

Image tag 3.2.2 Thread not permitted #429

psulightning opened this issue Sep 6, 2023 · 2 comments

Comments

@psulightning
Copy link

When attempting to use tag 3.2.2, I am unable to do gem install because of Thread not permitted:

Step 1/23 : FROM ruby:3.2.2
 ---> 41c4505d93f5
Step 2/23 : RUN gem install aws-sdk-secretsmanager
 ---> Running in 75b6669fde2c
ERROR:  While executing gem ... (ThreadError)
    can't create Thread: Operation not permitted
        /usr/local/lib/ruby/3.2.0/timeout.rb:101:in `initialize'
	/usr/local/lib/ruby/3.2.0/timeout.rb:101:in `new'
	/usr/local/lib/ruby/3.2.0/timeout.rb:101:in `create_timeout_thread'
	/usr/local/lib/ruby/3.2.0/timeout.rb:134:in `block in ensure_timeout_thread_created'
	/usr/local/lib/ruby/3.2.0/timeout.rb:132:in `synchronize'
	/usr/local/lib/ruby/3.2.0/timeout.rb:132:in `ensure_timeout_thread_created'
	/usr/local/lib/ruby/3.2.0/timeout.rb:181:in `timeout'
	/usr/local/lib/ruby/3.2.0/net/http.rb:1269:in `connect'
	/usr/local/lib/ruby/3.2.0/net/http.rb:1248:in `do_start'
	/usr/local/lib/ruby/3.2.0/net/http.rb:1243:in `start'
	/usr/local/lib/ruby/3.2.0/rubygems/request/http_pool.rb:43:in `setup_connection'
	/usr/local/lib/ruby/3.2.0/rubygems/request/https_pool.rb:7:in `setup_connection'
	/usr/local/lib/ruby/3.2.0/rubygems/request/http_pool.rb:39:in `make_connection'
	/usr/local/lib/ruby/3.2.0/rubygems/request/http_pool.rb:20:in `checkout'
	/usr/local/lib/ruby/3.2.0/rubygems/request.rb:129:in `connection_for'
	/usr/local/lib/ruby/3.2.0/rubygems/request.rb:188:in `perform_request'
	/usr/local/lib/ruby/3.2.0/rubygems/request.rb:154:in `fetch'
	/usr/local/lib/ruby/3.2.0/rubygems/remote_fetcher.rb:309:in `request'
	/usr/local/lib/ruby/3.2.0/rubygems/remote_fetcher.rb:209:in `fetch_http'
	/usr/local/lib/ruby/3.2.0/rubygems/remote_fetcher.rb:248:in `fetch_path'
	/usr/local/lib/ruby/3.2.0/rubygems/source.rb:88:in `dependency_resolver_set'
	/usr/local/lib/ruby/3.2.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
	/usr/local/lib/ruby/3.2.0/rubygems/source_list.rb:94:in `each'
	/usr/local/lib/ruby/3.2.0/rubygems/source_list.rb:94:in `each_source'
	/usr/local/lib/ruby/3.2.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
	/usr/local/lib/ruby/3.2.0/rubygems/resolver/best_set.rb:28:in `find_all'
	/usr/local/lib/ruby/3.2.0/rubygems/resolver/installer_set.rb:170:in `find_all'
	/usr/local/lib/ruby/3.2.0/rubygems/resolver/installer_set.rb:61:in `add_always_install'
	/usr/local/lib/ruby/3.2.0/rubygems/dependency_installer.rb:322:in `resolve_dependencies'
	/usr/local/lib/ruby/3.2.0/rubygems/commands/install_command.rb:205:in `install_gem'
	/usr/local/lib/ruby/3.2.0/rubygems/commands/install_command.rb:230:in `block in install_gems'
	/usr/local/lib/ruby/3.2.0/rubygems/commands/install_command.rb:223:in `each'
	/usr/local/lib/ruby/3.2.0/rubygems/commands/install_command.rb:223:in `install_gems'
	/usr/local/lib/ruby/3.2.0/rubygems/commands/install_command.rb:169:in `execute'
	/usr/local/lib/ruby/3.2.0/rubygems/command.rb:327:in `invoke_with_build_args'
	/usr/local/lib/ruby/3.2.0/rubygems/command_manager.rb:252:in `invoke_command'
	/usr/local/lib/ruby/3.2.0/rubygems/command_manager.rb:192:in `process_args'
	/usr/local/lib/ruby/3.2.0/rubygems/command_manager.rb:150:in `run'
	/usr/local/lib/ruby/3.2.0/rubygems/gem_runner.rb:51:in `run'
	/usr/local/bin/gem:10:in `<main>'

I have also tried moving gem update --system to see if the issue is with gem itself to no avail. If I switch to 3.2.2-bullseye, the build completes successfully.

@yosifkit
Copy link
Member

yosifkit commented Sep 6, 2023

(basically the same comment as docker-library/python#837 (comment) and redis/docker-library-redis#365 (comment))

Root cause: it is Docker with libseccomp so a newer syscall used in Debian Bookworm packages/libs is being blocked.

libseccomp lets you configure allowed syscalls for a process. Docker sets a default seccomp profile for all containers such that only certain syscalls are allowed and everything else is blocked (so, newer syscalls that are not yet known to libseccomp or docker are blocked).

  • verify that it is libseccomp by running the Bookworm-based image with --security-opt seccomp=unconfined
  • one fix:
    • update libseccomp and docker on the host running the containers
  • one workaround:
    • switch to the *bullseye images (in the ruby images, these will continue to be maintained/updated until the respective Ruby end of life or the next Debian release, Debian Trixie)

@psulightning
Copy link
Author

@yosifkit thanks. will use bullseye as a workaround. updating docker if a bit more effort in my situation.

avagin added a commit to google/gvisor that referenced this issue Jan 19, 2024
tgxworld added a commit to discourse/discourse_docker that referenced this issue Sep 4, 2024
When running the newer Debian bookworm based images, we are seeing
`(ThreadError) can't create Thread: Operation not permitted` errors when
trying to spawn a thread in Ruby.

A similar issue was reported in docker-library/ruby#429 (comment)
and the fix here is to upgrade Docker. Either way, we should probably
update because Docker 17 has been EOF for many many years.
tgxworld added a commit to discourse/discourse_docker that referenced this issue Sep 4, 2024
When running the newer Debian bookworm based images, we are seeing
`(ThreadError) can't create Thread: Operation not permitted` errors when
trying to spawn a thread in Ruby.

A similar issue was reported in docker-library/ruby#429 (comment)
and the fix here is to upgrade Docker. Either way, we should probably
update because Docker 17 has been EOF for many many years.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants