RequestGarbageCollectionForTesting causing segfault

97 views
Skip to first unread message

Jean-Philippe Déry

unread,
Mar 13, 2015, 10:55:40 PM3/13/15
to v8-u...@googlegroups.com
Hi,

I'm trying to use force garbage collection using RequestGarbageCollectionForTesting and for reasons unknown to me it's causing a segfault. Here's the sample code I run in a GoogleTest test case:

TEST_F(Test, FinalizeCallbackWithFreeValue)
{

 
Isolate* isolate = Isolate::New();
 
Isolate::Scope isolate_scope(isolate);
 
HandleScope handle_scope(isolate);
 
Local<Context> context = Context::New(isolate);
 
Context::Scope context_scope(context);

 LOGD
("STARTING GC");

 scope
->isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCollection);

 LOGD
("DONE GC");

}


Here's what the console's showing me, if that's any help


3-13 22:53:45.365    1059-1059/? A/libc Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)



03-13 22:53:45.875        34-34/? I/DEBUG *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

03-13 22:53:45.875        34-34/? I/DEBUG Build fingerprint: 'generic/sdk/generic:4.0.4/MR1/302030:eng/test-keys'

03-13 22:53:45.875        34-34/? I/DEBUG pid: 1059, tid: 1059  >>> /data/local/tmp/MetisCoreTests <<<

03-13 22:53:45.875        34-34/? I/DEBUG signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000

03-13 22:53:45.875        34-34/? I/DEBUG r0 0000000c  r1 27f00000  r2 00000001  r3 002404d0

03-13 22:53:45.875        34-34/? I/DEBUG r4 00054be0  r5 00050a68  r6 00000000  r7 406a67bd

03-13 22:53:45.885        34-34/? I/DEBUG r8 0006c7c0  r9 00000001  10 00000002  fp 00050a68

03-13 22:53:45.885        34-34/? I/DEBUG ip 0006c7e8  sp bed45938  lr 402fee44  pc 402fee54  cpsr 20000010

03-13 22:53:45.885        34-34/? I/DEBUG d0  74696d694c656361  d1  40623a013052fe1b

03-13 22:53:45.885        34-34/? I/DEBUG d2  00082400000a69e8  d3  00000000000a69e8

03-13 22:53:45.885        34-34/? I/DEBUG d4  eaffffebe59a0014  d5  000a69ece7f000fc

03-13 22:53:45.885        34-34/? I/DEBUG d6  000a69f04056e6f8  d7  3fe6a09e667f3bcd

03-13 22:53:45.885        34-34/? I/DEBUG d8  0000000000000000  d9  0000000000000000

03-13 22:53:45.885        34-34/? I/DEBUG d10 0000000000000000  d11 0000000000000000

03-13 22:53:45.885        34-34/? I/DEBUG d12 0000000000000000  d13 0000000000000000

03-13 22:53:45.885        34-34/? I/DEBUG d14 0000000000000000  d15 0000000000000000

03-13 22:53:45.885        34-34/? I/DEBUG scr 22000010

03-13 22:53:45.955        34-34/? I/DEBUG #00  pc 002fee54  /data/local/tmp/libMetisCore.so (_ZN2v88internal20MarkCompactCollector19StartSweeperThreadsEv)

03-13 22:53:45.955        34-34/? I/DEBUG #01  pc 00305c24  /data/local/tmp/libMetisCore.so (_ZN2v88internal20MarkCompactCollector11SweepSpacesEv)

03-13 22:53:45.955        34-34/? I/DEBUG #02  pc 0030a3a0  /data/local/tmp/libMetisCore.so (_ZN2v88internal20MarkCompactCollector14CollectGarbageEv)

03-13 22:53:45.955        34-34/? I/DEBUG #03  pc 002daef0  /data/local/tmp/libMetisCore.so (_ZN2v88internal4Heap11MarkCompactEv)

03-13 22:53:45.955        34-34/? I/DEBUG #04  pc 002db19c  /data/local/tmp/libMetisCore.so (_ZN2v88internal4Heap24PerformGarbageCollectionENS0_16GarbageCollectorENS_15GCCallbackFlagsE)

03-13 22:53:45.965        34-34/? I/DEBUG #05  pc 002dc988  /data/local/tmp/libMetisCore.so (_ZN2v88internal4Heap14CollectGarbageENS0_16GarbageCollectorEPKcS4_NS_15GCCallbackFlagsE)

03-13 22:53:45.965        34-34/? I/DEBUG #06  pc 002dcbd4  /data/local/tmp/libMetisCore.so (_ZN2v88internal4Heap17CollectAllGarbageEiPKcNS_15GCCallbackFlagsE)

03-13 22:53:45.965        34-34/? I/DEBUG #07  pc 0021fff8  /data/local/tmp/libMetisCore.so (_ZN2v87Isolate34RequestGarbageCollectionForTestingENS0_21GarbageCollectionTypeE)

03-13 22:53:45.965        34-34/? I/DEBUG #08  pc 0000d5d4  /data/local/tmp/MetisCoreTests

03-13 22:53:45.965        34-34/? I/DEBUG #09  pc 00024ec4  /data/local/tmp/MetisCoreTests

03-13 22:53:45.965        34-34/? I/DEBUG #10  pc 0001fd5c  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #11  pc 00014738  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #12  pc 00014cbc  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #13  pc 000153a4  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #14  pc 0001bf40  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #15  pc 00025ff4  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #16  pc 00020d1c  /data/local/tmp/MetisCoreTests

03-13 22:53:45.975        34-34/? I/DEBUG #17  pc 0001ade8  /data/local/tmp/MetisCoreTests

03-13 22:53:45.985        34-34/? I/DEBUG #18  pc 0000dae0  /data/local/tmp/MetisCoreTests

03-13 22:53:45.985        34-34/? I/DEBUG #19  pc 0000db24  /data/local/tmp/MetisCoreTests

03-13 22:53:45.985        34-34/? I/DEBUG #20  pc 00016740  /system/lib/libc.so (__libc_init)

03-13 22:53:45.985        34-34/? I/DEBUG code around pc:

03-13 22:53:45.985        34-34/? I/DEBUG 402fee34 e8bd83f0 e92d41f0 e1a04000 eb059f1e  .....A-..@......

03-13 22:53:45.985        34-34/? I/DEBUG 402fee44 e5945018 e5958640 e1a06000 e3a0000c  .P..@....`......

03-13 22:53:45.985        34-34/? I/DEBUG﹕ 402fee54 e5963000 e5937008 ebfc1d64 e59fc068  .0...p..d...h...

03-13 22:53:45.985        34-34/? I/DEBUG﹕ 402fee64 e3a02000 e79fc00c e1a03000 e1a00006  . .......0......

03-13 22:53:45.995        34-34/? I/DEBUG﹕ 402fee74 e1a01003 e5838008 e5835004 e28c5008  .........P...P..

03-13 22:53:45.995        34-34/? I/DEBUG﹕ code around lr:

03-13 22:53:45.995        34-34/? I/DEBUG﹕ 402fee24 eb007242 e2503000 1affffdf e28dd014  Br...0P.........

03-13 22:53:45.995        34-34/? I/DEBUG﹕ 402fee34 e8bd83f0 e92d41f0 e1a04000 eb059f1e  .....A-..@......

03-13 22:53:45.995        34-34/? I/DEBUG﹕ 402fee44 e5945018 e5958640 e1a06000 e3a0000c  .P..@....`
......

03-13 22:53:45.995        34-34/? I/DEBUG 402fee54 e5963000 e5937008 ebfc1d64 e59fc068  .0...p..d...h...

03-13 22:53:45.995        34-34/? I/DEBUG 402fee64 e3a02000 e79fc00c e1a03000 e1a00006  . .......0......

03-13 22:53:45.995        34-34/? I/DEBUG stack:

03-13 22:53:45.995        34-34/? I/DEBUG bed458f8  4440005c

03-13 22:53:45.995        34-34/? I/DEBUG bed458fc  40309e68  /data/local/tmp/libMetisCore.so

03-13 22:53:45.995        34-34/? I/DEBUG bed45900  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45904  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45908  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed4590c  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45910  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45914  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45918  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed4591c  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45920  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45924  00000000

03-13 22:53:46.005        34-34/? I/DEBUG bed45928  00054be0  [heap]

03-13 22:53:46.005        34-34/? I/DEBUG bed4592c  3a41a6a4

03-13 22:53:46.015        34-34/? I/DEBUG bed45930  df0027ad

03-13 22:53:46.015        34-34/? I/DEBUG bed45934  00000000

03-13 22:53:46.015        34-34/? I/DEBUG #00 bed45938  3a41a6a4

03-13 22:53:46.015        34-34/? I/DEBUG bed4593c  4274c163

03-13 22:53:46.015        34-34/? I/DEBUG bed45940  00054be0  [heap]

03-13 22:53:46.015        34-34/? I/DEBUG bed45944  406a67bd

03-13 22:53:46.015        34-34/? I/DEBUG bed45948  00050a68  [heap]

03-13 22:53:46.015        34-34/? I/DEBUG bed4594c  40305c28  /data/local/tmp/libMetisCore.so

03-13 22:53:46.015        34-34/? I/DEBUG #01 bed45950  00051136  [heap]

03-13 22:53:46.015        34-34/? I/DEBUG bed45954  405caab8  /data/local/tmp/libMetisCore.so

03-13 22:53:46.015        34-34/? I/DEBUG bed45958  3a41a600

03-13 22:53:46.015        34-34/? I/DEBUG bed4595c  4274c163

03-13 22:53:46.025        34-34/? I/DEBUG bed45960  00000000

03-13 22:53:46.025        34-34/? I/DEBUG bed45964  00000000

03-13 22:53:46.025        34-34/? I/DEBUG bed45968  3a41a52b

03-13 22:53:46.025        34-34/? I/DEBUG bed4596c  00054be0  [heap]

03-13 22:53:46.025        34-34/? I/DEBUG bed45970  00054be0  [heap]

03-13 22:53:46.025        34-34/? I/DEBUG bed45974  0010582c

03-13 22:53:46.025        34-34/? I/DEBUG bed45978  00050a58  [heap]

03-13 22:53:46.025        34-34/? I/DEBUG bed4597c  406a2da4  /data/local/tmp/libMetisCore.so

03-13 22:53:46.025        34-34/? I/DEBUG bed45980  00000001

03-13 22:53:46.035        34-34/? I/DEBUG bed45984  00000002

03-13 22:53:46.035        34-34/? I/DEBUG bed45988  00050a68  [heap]

03-13 22:53:46.035        34-34/? I/DEBUG bed4598c  4030a3a4  /data/local/tmp/libMetisCore.so

03-13 22:53:46.075      686-707/system_process I/BootReceiver Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE)




I've built V8 4.1.0.20 for android arm and I'm running these tests on the android emulator.

Any ideas ? I didn't have this issue with V8 3.25

Thanks!


Jean-Philippe Déry

unread,
Mar 13, 2015, 11:08:59 PM3/13/15
to v8-u...@googlegroups.com
Right after posting I noticed an error in the code below where "scope" was not defined. I fixed it however the segfault remains.
...

Jean-Philippe Déry

unread,
Mar 14, 2015, 1:25:11 PM3/14/15
to v8-u...@googlegroups.com
Fixed it!

Turns out this part is actually important:

Platform* platform = platform::CreateDefaultPlatform();
V8
::InitializePlatform(platform);


On Friday, 13 March 2015 22:55:40 UTC-4, Jean-Philippe Déry wrote:
...
Reply all
Reply to author
Forward
0 new messages