
Issue #19397 has been updated by john_d_s (John Damm Soerensen). ``` I am using Centos 7.8 and further investigations shows that the problem occurs when soft and hard limits are equal. In our case 157286400. Lowering the softlimit will make ruby run without error. I have made similar tes on Ffedora 36 and here the code runs without problems. Se the following from Centos cat /proc/self/limits Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited seconds Max file size unlimited unlimited bytes Max data size unlimited unlimited bytes Max stack size 157286400 157286400 bytes Max core file size unlimited unlimited bytes Max resident set unlimited unlimited bytes Max processes 688754 688754 processes Max open files 32768 32768 files Max locked memory unlimited unlimited bytes Max address space unlimited unlimited bytes Max file locks unlimited unlimited locks Max pending signals 688754 688754 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us ./ruby -h Segmentation fault (core dumped) ulimit -S -s 1572 ./ruby -h Usage: /home/projects/sysadmin/people/johnd/ruby/ruby [switches] [--] [programfile] [arguments] -0[octal] specify record separator (\0, if no argument) -a autosplit mode with -n or -p (splits $_ into $F) -c check syntax only -Cdirectory cd to directory before executing your script -d set debugging flags (set $DEBUG to true) -e 'command' one line of script. Several -e's allowed. Omit [programfile] -Eex[:in] specify the default external and internal character encodings -Fpattern split() pattern for autosplit (-a) -i[extension] edit ARGV files in place (make backup if extension supplied) -Idirectory specify $LOAD_PATH directory (may be used more than once) -l enable line ending processing -n assume 'while gets(); ... end' loop around your script -p assume loop like -n but print line also like sed -rlibrary require the library before executing your script -s enable some switch parsing for switches after script name -S look for the script using PATH environment variable -v print the version number, then turn on verbose mode -w turn warnings on for your script -W[level=2|:category] set warning level; 0=silence, 1=medium, 2=verbose -x[directory] strip off text before #!ruby line and perhaps cd to directory --jit enable JIT for the platform, same as --mjit (experimental) --mjit enable C compiler-based JIT compiler (experimental) -h show this message, --help for more info cat /proc/self/limits Limit Soft Limit Hard Limit Units Max cpu time unlimited unlimited seconds Max file size unlimited unlimited bytes Max data size unlimited unlimited bytes Max stack size 1609728 157286400 bytes Max core file size unlimited unlimited bytes Max resident set unlimited unlimited bytes Max processes 688754 688754 processes Max open files 32768 32768 files Max locked memory unlimited unlimited bytes Max address space unlimited unlimited bytes Max file locks unlimited unlimited locks Max pending signals 688754 688754 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us ``` ---------------------------------------- Bug #19397: ruby -h fails with SIGSGV if ulimit -s is any else than unlimited https://bugs.ruby-lang.org/issues/19397#change-101607 * Author: john_d_s (John Damm Soerensen) * Status: Feedback * Priority: Normal * ruby -v: ruby 3.3.0dev (2023-01-30T23:43:40Z master 7439ccf0ed) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- This applies to all versions of ruby. I have tried these 2.6.3 2.6.6 2.7.2 3.0.0 3.2.0 To reproduce simply set `ulimit -s` to anything other than unlimited. Then run `ruby -h` (or any other invocation of ruby) and ruby will generate a SIGSEGV and core dump. The stack trace from gdb shows that ruby has failed in reserve_stack line 1022 (for the latest from github) gdb ruby core.11885 ``` Core was generated by `./ruby -h'. Program terminated with signal 11, Segmentation fault. #0 reserve_stack (limit=0x7e9a5f4400e0 <Address 0x7e9a5f4400e0 out of bounds>, limit@entry=0x7fffffffe000 "l=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.axv=38;5;13:*.anx=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.mid=38;5;45:*.midi=3"..., size=1535999991552, size@entry=1535999995904) at thread_pthread.c:1022 1022 limit[0] = 0; ``` -- https://bugs.ruby-lang.org/