From: peter@... Date: 2021-02-23T21:34:38+00:00 Subject: [ruby-core:102585] [Ruby master Bug#17652] GC compaction crash on mprotect Issue #17652 has been reported by peterzhu2118 (Peter Zhu). ---------------------------------------- Bug #17652: GC compaction crash on mprotect https://bugs.ruby-lang.org/issues/17652 * Author: peterzhu2118 (Peter Zhu) * Status: Open * Priority: Normal * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- # GitHub PR: TODO # Issue GC compaction will crash on some pages due to a failing `mprotect` call. According to the `mprotect` documentation: > POSIX says that the behavior of mprotect() is unspecified if it is applied to a region of memory that was not obtained via mmap(2). This causes `mprotect` to sometimes fail. # Reproduction ```ruby GC.auto_compact = true times = 20_000_000 arr = Array.new(times) times.times do |i| arr[i] = "#{i}" end arr = Array.new(1_000_000, 42) GC.start puts "ok" ``` # Expected output Program runs and prints "ok". # Actual output Crashes on Ubuntu 18.04. See `crash.log` for the crash log (note that the log file has been truncated because it's too big). ---Files-------------------------------- crash.log (6.26 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: