From: Eric Wong Date: 2014-02-12T21:16:34+00:00 Subject: [ruby-core:60671] Re: [ruby-trunk - Bug #9514] [Open] Huge query crash ruby core waghanza@gmail.com wrote: > I have made a query on a [[http://teradata.com|terradata]] server using https://github.com/priviterag/teradata-cli >
    /usr/local/share/gems/gems/teradata-cli-0.0.12/lib/teradata-cli/connection.rb:1055:
> [BUG] object allocation during garbage collection phase

It is likely the following in ext/teradata-cli/cli/cli.c:

	  static void
	cli_free(struct rb_cli *p)
	{
	  if (p->logging_on) {
	    logoff(p, Qtrue);
	  }
	}

Maybe if disabling logging will avoid calling the logoff function,
you won't hit the [BUG].

The logoff function is not safe to call inside the GC free phase
since it uses rb_raise:

	  static void
	logoff(struct rb_cli *p, VALUE force)
	{
	  Int32 status;
	  char dummy[4] = {0, 0, 0, 0};

	  p->dbcarea.func = DBFDSC;
	  DBCHCL(&status, dummy, &p->dbcarea);
	  if (!force && status != EM_OK) {
	    rb_raise(CLIError, "CLI error: [%s] %s",
		status_name(status), p->dbcarea.msg_text);
	  }
	  p->logging_on = Qfalse;
	}

I do not know the non-Ruby API at all, so DBCHCL/DBFDSC macros /may/
not be safe, either.

Can you contact the teradata-cli authors and forward this to them?
I don't know anything about teradata-cli and do not have time to test.

>     0 enumerator.so
>     1 /usr/lib64/ruby/enc/encdb.so
>     2 /usr/lib64/ruby/enc/trans/transdb.so
>     27 /usr/lib64/ruby/date_core.so
>     30 /usr/lib64/ruby/stringio.so
>     33 /usr/lib64/ruby/vendor_ruby/psych.so
>     44 /usr/lib64/ruby/strscan.so
>     72 /usr/local/lib64/gems/ruby/teradata-cli-0.0.12/teradata-cli/cli.so
>     79 /usr/lib64/ruby/enc/utf_16le.so
>     80 /usr/lib64/ruby/enc/utf_16be.so
The rest of the C extensions you have look to be in the standard distro, so teradata-cli/cli.so was the most likely candidate to look for bugs in.