cext GC collects classes and modules that are still in use
----------------------------------------------------------

                 Key: JRUBY-5690
                 URL: http://jira.codehaus.org/browse/JRUBY-5690
             Project: JRuby
          Issue Type: Bug
          Components: C Extensions
    Affects Versions: JRuby 1.6
            Reporter: Aman Gupta
            Assignee: Thomas E Enebo
            Priority: Critical


I can repro this with the mysql gem.

{noformat}
require 'vendor/gems/jruby/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle'

conn = Mysql.connect
num = 10_000
num.times do |i|
  begin
    print '.'
    conn.query('select 1+2+3')
  rescue Object => e
    puts i
    raise e
  end
end
{noformat}

After 5k iterations, this results in an NPE:

{noformat}
RubyBasicObject.java:1595:in `ensureInstanceVariablesSettable': 
java.lang.NullPointerException
        from RubyBasicObject.java:1526:in `setInstanceVariable'
        from Native.java:-2:in `callMethod1'
        from NativeMethod1.java:48:in `call'
        from CachingCallSite.java:137:in `call'
        from mytest.rb:6:in `block_0$RUBY$__file__'
        from mytest$block_0$RUBY$__file__:65535:in `call'
        from CompiledBlock.java:112:in `yield'
        from CompiledBlock.java:95:in `yield'
        from Block.java:130:in `yield'
        from RubyFixnum.java:252:in `times'
        from RubyFixnum$i$0$0$times.gen:65535:in `call'
        from CachingCallSite.java:272:in `cacheAndCall'
        from CachingCallSite.java:114:in `callBlock'
        from CachingCallSite.java:123:in `callIter'
        from mytest.rb:3:in `__file__'
        from mytest.rb:-1:in `load'
        from Ruby.java:671:in `runScript'
        from Ruby.java:575:in `runNormally'
        from Ruby.java:424:in `runFromMain'
        from Main.java:278:in `doRunFromMain'
        from Main.java:198:in `internalRun'
        from Main.java:164:in `run'
        from Main.java:148:in `run'
        from Main.java:128:in `main'
{noformat}

Or sometimes, a segfault.

{noformat}
Invalid memory access of location 0x8 rip=0x10109f2b7

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000008
[Switching to process 21473 thread 0xc13]
0x000000010109f2b7 in JVM_Lseek ()
(gdb) where
#0  0x000000010109f2b7 in JVM_Lseek ()
#1  0x000000010109ed77 in JVM_Lseek ()
#2  0x000000010109eb7a in JVM_Lseek ()
#3  0x00000001010c1af1 in JVM_FindLoadedClass ()
#4  0x000000010130e2ca in pss ()
#5  0x000000010b759b80 in JNIEnv_::CallStaticObjectMethodA ()
#6  0x000000010b759aae in rb_data_object_alloc ()
#7  0x000000010b7a90bd in mysqlres2obj (res=0x10da92890) at mysql.c:182
#8  0x000000010b7ab0b5 in store_result (obj=4319213104) at mysql.c:708
#9  0x000000010b7ab407 in query (obj=4319213104, sql=4524158320) at mysql.c:764
#10 0x000000010b75c632 in Java_org_jruby_cext_Native_callMethod1 ()
#11 0x0000000103811cc8 in ?? ()
#12 0x00000001038069b3 in ?? ()
#13 0x00000001038069b3 in ?? ()
#14 0x00000001038069b3 in ?? ()
#15 0x00000001038069b3 in ?? ()
#16 0x00000001038069b3 in ?? ()
#17 0x00000001038069b3 in ?? ()
#18 0x00000001038069b3 in ?? ()
#19 0x00000001038069b3 in ?? ()
#20 0x00000001038069b3 in ?? ()
#21 0x00000001038069b3 in ?? ()
#22 0x00000001038069b3 in ?? ()
#23 0x00000001038069b3 in ?? ()
#24 0x00000001038069b3 in ?? ()
#25 0x00000001038069b3 in ?? ()
#26 0x00000001038069b3 in ?? ()
#27 0x0000000103806e8d in ?? ()
#28 0x00000001038069b3 in ?? ()
#29 0x00000001038069b3 in ?? ()
#30 0x000000010380685a in ?? ()
#31 0x00000001038069b3 in ?? ()
#32 0x00000001038069b3 in ?? ()
#33 0x00000001038069b3 in ?? ()
#34 0x00000001038069b3 in ?? ()
#35 0x0000000103801438 in ?? ()
#36 0x000000010109eda7 in JVM_Lseek ()
#37 0x000000010109eb7a in JVM_Lseek ()
#38 0x00000001010c1af1 in JVM_FindLoadedClass ()
#39 0x00000001010c1999 in JVM_FindLoadedClass ()
#40 0x0000000100002d23 in ArgParser::setupMaxHeapAndStack ()
#41 0x0000000100003270 in ArgParser::setupMaxHeapAndStack ()
#42 0x00007fff88bd54f6 in _pthread_start ()
#43 0x00007fff88bd53a9 in thread_start ()
{noformat}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to