kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Hleb Valoshka <375gnu@gmail.com>
To: Petr Novodvorskiy <nidd@skytap.com>
Cc: kgio-public@bogomips.org, Lara Martin <lmartin@skytap.com>,
	 Nick Astete <nastete@skytap.com>
Subject: Re: programs using kgio crash under memory pressure during init
Date: Tue, 30 Dec 2014 10:40:43 +0300	[thread overview]
Message-ID: <CAAB-KckM0cSuQUcA-cCzf67pxN4VnmYV7m=rMYYm6GYMgZ1V1Q@mail.gmail.com> (raw)
In-Reply-To: <CAHGF7iJk9-wK5WbSiAgQaRye7y2RJttLBpykRBpnKkxFi=ASHg@mail.gmail.com>

On 12/30/14, Petr Novodvorskiy <nidd@skytap.com> wrote:
> After looking in the code, I think I was able to identify the problem. In
> init_kgio_tryopen(), when rb_funcall is called to get list of errno
> constants, it doesn't protect returned list from garbage collecting. I made
> modification (below) that seemed to fix the problem (I wasn't able to
> reproduce it anymore).

> +        tmp = rb_protect(get_err_constants, (VALUE)NULL, &exception);

I don't know why does it help, but rb_protect is wrong function for
your purpose:
VALUE rb_protect(VALUE (*func) (VALUE), VALUE arg, int *state)

    Calls the function func with arg as the argument. If no exception
occured during func, it returns the result of func and *state is zero.
Otherwise, it returns Qnil and sets *state to nonzero. If state is
NULL, it is not set in both cases. You have to clear the error info
with rb_set_errinfo(Qnil) when ignoring the caught exception.

  parent reply	other threads:[~2014-12-30  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30  7:00 programs using kgio crash under memory pressure during init Petr Novodvorskiy
2014-12-30  7:22 ` Eric Wong
2014-12-30  7:40 ` Hleb Valoshka [this message]
2015-01-06  3:11 ` Eric Wong
2015-01-09  2:10 ` [PATCH] tryopen: add RB_GC_GUARD for Ruby 1.8 Eric Wong

Reply instructions:

You may reply publicly 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/kgio/

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

  git send-email \
    --in-reply-to='CAAB-KckM0cSuQUcA-cCzf67pxN4VnmYV7m=rMYYm6GYMgZ1V1Q@mail.gmail.com' \
    --to=375gnu@gmail.com \
    --cc=kgio-public@bogomips.org \
    --cc=lmartin@skytap.com \
    --cc=nastete@skytap.com \
    --cc=nidd@skytap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).