On Thu, Feb 05, 2009 at 02:45:21PM -0500, Aaron Lav wrote: > It seems like there's a bug which sometimes causes passing lists of > ints to Java int[]s to generate a SIGSEGV. > ...
I've noticed that a call to the wrapped functions doesn't seem to be necessary to generate the exception: all that's required is that the module be imported and the JVM initalized. The list then seems to have an element set to NULL, and any access, whether from Python or from jcc trying to convert it to a JArray<int>, will fault. (I realized this while trying to figure out why my hardware watchpoints weren't triggering.) I'm attaching a revised test_array.py which still generates a SIGSEGV, and a gdb session. (The NULL tends to show up at one or two offsets, although the what offsets those are may vary with the code and environment running, which is how I knew to look at 0x1a92a4 in the gdb session.) Aaron Lav (a...@pobox.com)
This GDB was configured as "x86_64-linux-gnu"... (no debugging symbols found) (gdb) set args test_array.py (gdb) break org::dyndns::asl2::TestJcc::t_TestJcc_init_(org::dyndns::asl2::TestJcc::t_TestJcc*, _object*, _object*) Function "org::dyndns::asl2::TestJcc::t_TestJcc_init_(org::dyndns::asl2::TestJcc::t_TestJcc*, _object*, _object*)" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (org::dyndns::asl2::TestJcc::t_TestJcc_init_(org::dyndns::asl2::TestJcc::t_TestJcc*, _object*, _object*)) pending. (gdb) run Starting program: /usr/bin/python test_array.py (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [New Thread 0x7fc22d7fc6e0 (LWP 11766)] (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [New Thread 0x417ae950 (LWP 11769)] [New Thread 0x418af950 (LWP 11770)] [New Thread 0x41630950 (LWP 11771)] [New Thread 0x41347950 (LWP 11772)] [New Thread 0x41448950 (LWP 11773)] [New Thread 0x41cca950 (LWP 11774)] [New Thread 0x41dcb950 (LWP 11775)] [New Thread 0x41ecc950 (LWP 11776)] [New Thread 0x41fcd950 (LWP 11777)] [New Thread 0x40f8f950 (LWP 11778)] 0x7fc22d714d88 0x7fc22d714f80 [Switching to Thread 0x7fc22d7fc6e0 (LWP 11766)] ---Type <return> to continue, or q <return> to quit--- Breakpoint 1, 0x00007fc22c7c6f10 in org::dyndns::asl2::TestJcc::t_TestJcc_init_ () from /home/asl2/repos/people/alav/ticket_4583/build/lib.linux-x86_64-2.4/testjcc/_testjcc.so (gdb) x/20g 0x7fc22d714f80 0x7fc22d714f80: 0x0000000000000002 0x0000000000700280 0x7fc22d714f90: 0x00000000001e847e 0x00007fc1e4139010 0x7fc22d714fa0: 0x000000000021a1a7 0x0000000000000000 0x7fc22d714fb0: 0x00007fc22d714f60 0x00000000fffffffe 0x7fc22d714fc0: 0x0000000000000000 0x0000000000000000 0x7fc22d714fd0: 0x0000000000700280 0x00000000001e847e 0x7fc22d714fe0: 0x00007fc1e284e7a0 0x00000000001e847e 0x7fc22d714ff0: 0x0000000000000000 0x0000000000000000 0x7fc22d715000: 0x000000000000003f 0x0000000000000000 0x7fc22d715010: 0x0000000000702920 0x0000000000702920 (gdb) x/10g 0x00007fc1e4139010 + (8*0x1a92a4) 0x7fc1e4e82530: 0x0000000000000000 0x00007fc1da064a58 0x7fc1e4e82540: 0x00007fc1da064a40 0x00007fc1da064a28 0x7fc1e4e82550: 0x00007fc1da0651d8 0x00007fc1da0651c0 0x7fc1e4e82560: 0x00007fc1da0651a8 0x00007fc1da065190 0x7fc1e4e82570: 0x00007fc1da065178 0x00007fc1da065160
import _testjcc def test(): count = 999999 # crashes count = 950000 # doesn't count = 975000 # maybe 1 in 4? sometimes count = 999999 * 2 a = [i for i in range(count)] b = [i for i in range(count)] print hex(id(a)), hex(id(b)) for j in a: assert type(j) == int for j in b: assert type(j) == int # factory = _testjcc.TestJcc(a,b) if __name__ == '__main__': # initalizing the VM is required to generate the error. _testjcc.initVM(classpath='.', vmargs="-Xcheck:jni") test()