From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 915E91F5AE; Mon, 24 May 2021 17:22:08 +0000 (UTC) Date: Mon, 24 May 2021 17:22:08 +0000 From: Eric Wong To: Ngan Pham Cc: kgio-public@yhbt.net Subject: Re: Patch for GC.compact memory issue Message-ID: <20210524172208.GA7627@dcvr> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: Ngan Pham wrote: > Hello, I'd like to submit a patch to fix an issue after running > `GC.compact`. The LOCALHOST variable is defined in Ruby and is > resolved and memoized (to `localhost`) in C once. However, the pointer > in C is not GC marked. Running `GC.compact` potentially moves the > `LOCALHOST` object in Ruby causing `localhost` to point to a bad or > empty slot. This causes `env['REMOTE_ADDR']` to a bad object in > Unicorn. Seems to make sense. > Some useful links: > - `GC.compact` introduced: https://bugs.ruby-lang.org/issues/15626. > - My conversation with tenderlove over twitter on this issue: > https://twitter.com/tenderlove/status/1396625048861954049 Can you please copy+paste the conversation here? Accessibility-challenged users such as myself cannot read it without JavaScript. Thanks.