From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS47066 71.19.144.0/20 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.kgio.general Subject: Re: kgio_ext.so: [BUG] constant not a symbol or string Date: Fri, 27 Dec 2013 07:41:29 +0000 Message-ID: <20131227074129.GA6381@dcvr.yhbt.net> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1388130095 32728 80.91.229.3 (27 Dec 2013 07:41:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Dec 2013 07:41:35 +0000 (UTC) To: kgio@librelist.org Original-X-From: kgio@librelist.org Fri Dec 27 08:41:43 2013 Return-path: Envelope-to: gclrkg-kgio@m.gmane.org List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: kgio@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.kgio.general:247 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VwS3C-0007dp-Mh for gclrkg-kgio@m.gmane.org; Fri, 27 Dec 2013 08:41:42 +0100 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 3116774B3F for ; Fri, 27 Dec 2013 07:46:51 +0000 (UTC) Christopher Rigor wrote: > When I start sidekiq from the command line, it runs correctly. When it is > started from monit, I get kgio_ext.so: [BUG] constant not a symbol or > string. Can you verify this is the same instance of sidekiq and loading the same libraries from the same paths? Also, are you using RVM or rbenv or similar? Can you reproduce the issue without those? > I'm using kgio 2.8.0 and ruby 2.0.0 p353. > > I know monit doesn't set some environment variables but I didn't expect to > encounter an issue with Ruby internals if an environment variable is > missing. > > Based on the backtrace "kgio-2.8.0/lib/kgio_ext.so(init_kgio_tryopen+0x1a9) > [0x7fe93d120359]" I found the code where the error came from. > http://repo.or.cz/w/kgio.git/blob/8be51237720fd18cb45188f29c717bbac0ca1964:/ext/kgio/tryopen.c#l173 > > 1. Is this an error on kgio? Unlikely :> > 2. Did I give enough information to pinpoint the issue? Not yet, but we'll get there. > 3. How can I debug this? What tools do you use for this kind of problems? I suspect something is mixed up with the installation/loading via monit. Most likely, the kgio you're loading is for a different version of Ruby than what you're running. Or (unlikely) something is monkeypatching Errno.constants to return bogus output... Since you're running Ruby 2.0, you should see an array of symbols (and nothing else) from the following command: ruby -e 'p Errno.constants' You can also try dumping Errno.constants at various places in the sidekiq code. Sorry, I'm not familiar with sidekiq; but hopefully it's not mangling Errno.constants output under monit somehow. Also, the following patch should give you a little more debug output: --- a/ext/kgio/tryopen.c +++ b/ext/kgio/tryopen.c @@ -173,7 +173,12 @@ void init_kgio_tryopen(void) switch (TYPE(err)) { case T_SYMBOL: const_id = SYM2ID(err); break; case T_STRING: const_id = rb_intern(RSTRING_PTR(err)); break; - default: rb_bug("constant not a symbol or string"); + default: { + VALUE i = rb_inspect(err); + const char *s = StringValueCStr(i); + + rb_bug("constant not a symbol or string: %s", s); + } } error = rb_const_get(rb_mErrno, const_id);