kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* kgio_ext.so: [BUG] constant not a symbol or string
@ 2013-12-27  6:23 Christopher Rigor
  2013-12-27  7:41 ` Eric Wong
  2014-01-16 23:54 ` Eric Wong
  0 siblings, 2 replies; 5+ messages in thread
From: Christopher Rigor @ 2013-12-27  6:23 UTC (permalink / raw)
  To: kgio

Hi,

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.

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?
2. Did I give enough information to pinpoint the issue?
3. How can I debug this? What tools do you use for this kind of problems?

Regards,
Christopher


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgio_ext.so: [BUG] constant not a symbol or string
  2013-12-27  6:23 kgio_ext.so: [BUG] constant not a symbol or string Christopher Rigor
@ 2013-12-27  7:41 ` Eric Wong
  2014-01-16 23:54 ` Eric Wong
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Wong @ 2013-12-27  7:41 UTC (permalink / raw)
  To: kgio

Christopher Rigor <crigor@gmail.com> 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);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgio_ext.so: [BUG] constant not a symbol or string
  2013-12-27  6:23 kgio_ext.so: [BUG] constant not a symbol or string Christopher Rigor
  2013-12-27  7:41 ` Eric Wong
@ 2014-01-16 23:54 ` Eric Wong
  2014-02-04  2:38   ` Christopher Rigor
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Wong @ 2014-01-16 23:54 UTC (permalink / raw)
  To: kgio

Ping!  Were you able to resolve this issue?  Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgio_ext.so: [BUG] constant not a symbol or string
  2014-01-16 23:54 ` Eric Wong
@ 2014-02-04  2:38   ` Christopher Rigor
  2014-02-04  3:04     ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Rigor @ 2014-02-04  2:38 UTC (permalink / raw)
  To: kgio

Sorry for the late reply Eric. Your first reply went to my spam folder.

We replaced the server and didn't see this issue again. The server is
set up the same way. We don't use RVM or similar.

Thanks for the patch. This will help in the future.

-Christopher

On Fri, Jan 17, 2014 at 7:54 AM, Eric Wong <normalperson@yhbt.net> wrote:
> Ping!  Were you able to resolve this issue?  Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kgio_ext.so: [BUG] constant not a symbol or string
  2014-02-04  2:38   ` Christopher Rigor
@ 2014-02-04  3:04     ` Eric Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2014-02-04  3:04 UTC (permalink / raw)
  To: kgio

Thanks for the response.  I suspect your issue was due to a stray
object file leftover/copied from a previous installation.

I'll commit that patch just in case and release 2.9.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-04  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-27  6:23 kgio_ext.so: [BUG] constant not a symbol or string Christopher Rigor
2013-12-27  7:41 ` Eric Wong
2014-01-16 23:54 ` Eric Wong
2014-02-04  2:38   ` Christopher Rigor
2014-02-04  3:04     ` Eric Wong

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).