unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Xuanzhong Wei <azrlew@gmail.com>
To: unicorn-public@bogomips.org
Cc: Xuanzhong Wei <azrlew@gmail.com>
Subject: [PATCH] fix GC issue on rb_global_variable array
Date: Tue,  3 Oct 2017 23:57:18 +0900
Message-ID: <20171003145718.30404-1-azrlew@gmail.com> (raw)

We need to add the array to ruby's global_list right after created it;
otherwise it probably gets GCed.
 ext/unicorn_http/unicorn_http.rl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl
index 6fc3498..357440b 100644
--- a/ext/unicorn_http/unicorn_http.rl
+++ b/ext/unicorn_http/unicorn_http.rl
@@ -921,6 +921,7 @@ void Init_unicorn_http(void)
   VALUE mUnicorn, cHttpParser;
   mark_ary = rb_ary_new();
+  rb_global_variable(&mark_ary);
   mUnicorn = rb_define_module("Unicorn");
   cHttpParser = rb_define_class_under(mUnicorn, "HttpParser", rb_cObject);
   eHttpParserError =
@@ -976,7 +977,6 @@ void Init_unicorn_http(void)
-  rb_global_variable(&mark_ary);
   id_clear = rb_intern("clear");

             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 14:57 Xuanzhong Wei [this message]
2017-10-03 17:47 ` Eric Wong
2017-10-03 18:26   ` Xuanzhong Wei

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://bogomips.org/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171003145718.30404-1-azrlew@gmail.com \
    --to=azrlew@gmail.com \
    --cc=unicorn-public@bogomips.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/unicorn-public
	git clone --mirror http://ou63pmih66umazou.onion/unicorn-public

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox