Closed rodti closed 6 years ago
I've also noticed this under rootless podman containers.
This issue isn't related to Crystal itself, but the shards package manager. Please open the issue in this project: https://github.com/crystal-lang/crystal/shards
I also get a crash running crystal as a normal user.
Doesn't look like it's specific to shards
.
And Failed to raise an exception: END_OF_STACK
doesn't either.
I use LXC containers everyday, and never had such an issue. I would easily blame systemd, maybe.
@rodti are you sure you have read/write permissions on the directories used by shards
?
I got this as a normal user in /srv
:
Unhandled exception: Error opening file '/srv/shard.yml' with mode 'w': Permission denied (Errno)
Failed to raise an exception: END_OF_STACK
[0x557996f25c56] *CallStack::print_backtrace:Int32 +118
[0x557996f08b46] __crystal_raise +86
[0x557996f090ee] *raise<Errno>:NoReturn +206
[0x557996f5b3d9] *Crystal::System::File::open<String, String, File::Permissions>:Int32 +201
[0x557996f50a0d] *File::new<String, String, File::Permissions, Nil, Nil>:File +45
[0x557996f1d3dd] *CallStack::read_dwarf_sections:(Array(Tuple(UInt64, UInt64, String)) | Nil) +109
[0x557996f1d11d] *CallStack::decode_line_number<UInt64>:Tuple(String | Nil, Int32, Int32) +45
[0x557996f1c8c8] *CallStack#decode_backtrace:Array(String) +296
[0x557996f1c782] *CallStack#printable_backtrace:Array(String)+ +50
[0x557996f5063d] *Exception+ +77
[0x557996f50088] *Exception+ +120
[0x557996fa0978] *AtExitHandlers::run<Int32>:Int32 +488
[0x557996f85654] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +148
[0x557996f13816] main +6
[0x7f2aaa8ccad6] __libc_start_main +54
I got this by compiling shards statically with crystal build --static --link-flags -lunwind src/shards.cr
:
Failed to raise an exception: END_OF_STACK
[0x0] ???
Hi everyone, apologies for the delay in replying.
I've created a brand new LXC container on a different Proxmox (pve 5.2-2) host. This uses a Debian 9.3.1 image.
I've run apt-get dist-upgrade
to ensure everything's up to date, added apt-transport-https
, then followed the instructions for Debian/Ubuntu to add Crystal's aptitude source. I've install using apt install crystal
which completes successfully with all dependencies.
I then ran adduser test
to create a 'test' user.
Running crystal
as root in /root gives:
Usage: crystal [command] [switches] [program file] [--] [arguments]
Command:
init generate a new project
build build an executable
docs generate documentation
env print Crystal environment information
eval eval code from args or standard input
play starts crystal playground server
run (default) build and run program
spec build and run specs (in spec directory)
tool run a tool
help, --help, -h show this help
version, --version, -v show version
Running shards
as root in /root gives:
Missing shard.yml. Please run 'shards init'
Running crystal
as test in /home/test gives:
Failed to raise an exception: END_OF_STACK
[0x7fed6d889746] ???
[0x7fed6cf82349] ???
[0x7fed6cf83488] ???
[0x7fed6cf882a3] ???
[0x7fed6cfbb3f6] ???
[0x7fed6cf8679d] ???
[0x7fed6ecc8dfe] ???
Running shards
as test in /home/test gives:
Failed to raise an exception: END_OF_STACK
[0x7f6f4dd6e826] ???
[0x7f6f4dd128a3] ???
[0x7f6f4dd134b8] ???
[0x7f6f4dd156d3] ???
[0x7f6f4dd368c2] ???
[0x7f6f4dd148fd] ???
[0x7f6f4dfbb9a5] ???
Happy to share any logs if required.
Your container is restricting access to something that Crystal depends on (e.g. a file from /dev or proc).
You can use strace crystal
to understand where it's failing. For example, these paths will be open by crystal or a dependency (bdwgc, libevent, ...):
Your container is restricting access to something that Crystal depends on (e.g. a file from /dev or proc).
Thanks for the tip. I've run strace and it was failing on /dev/tty1 access. I've changed the permissions on /dev/tty1 to a fairly loose 777 and it now works correctly.
Odd that it needs a workaround though!
Related to #6518
When I went to apply the fix to the container where I noticed this issue it was /dev/pts3 rather than /dev/tty1, but adding the user to group tty and setting permissions to 660 worked. I'm assuming this is a peculiarity of LXC and not Crystal, so will close this issue.
Duplicate of #6624
Fixed by https://github.com/crystal-lang/crystal/pull/6660 most likely.
Clean install of Crystal (via aptitude) on Debian 9, running in a Proxmox LXC container.
Running shards as root gives expected results:
Missing shard.yml. Please run 'shards init'
Running shards for any other normal user account (without sudo) crashes:
I also get a crash running crystal as a normal user. I've tried this with several new user accounts, all have the same issue.
Also, out of abundance of caution, I've tried this on both unprivileged and privileged LXC containers, with identical results.