Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active March 24, 2019 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/390209116dbc0ef3efd5755659ccc38e to your computer and use it in GitHub Desktop.
Save dogbert17/390209116dbc0ef3efd5755659ccc38e to your computer and use it in GitHub Desktop.
Reproducible crash in t/04-nativecall/06-struct.t when running with a small nursery
dogbert@dogbert-VirtualBox ~/repos/rakudo $ ./perl6 -v
This is Rakudo version 2019.03.1-114-g888cf8c built on MoarVM version 2019.03-44-g079d670
implementing Perl 6.d.
dogbert@dogbert-VirtualBox ~/repos/rakudo $ MVM_SPESH_DISABLE=1 ./perl6 t/04-nativecall/06-struct.t
1..34
ok 1 - getting long
ok 2 - getting num
ok 3 - getting int8
ok 4 - getting num32
ok 5 - getting CArray and element
ok 6 - getting long from C-created struct
ok 7 - getting num from C-created struct
ok 8 - getting int8 from C-created struct
ok 9 - getting num32 from C-created struct
ok 10 - C-created array member, elem 1
ok 11 - C-created array member, elem 2
ok 12 - C-created array member, elem 3
ok 13 - field 1 from struct 1 in struct
ok 14 - field 2 from struct 1 in struct
ok 15 - field 1 from struct 2 in struct
ok 16 - field 2 from struct 2 in struct
ok 17 - CPointer object in struct
ok 18 - first string in struct
ok 19 - second string in struct
ok 20 - C-side values in struct
ok 21 - Setting a CArray struct element to type object passes a NULL to C
ok 22 - C-side values in struct struct
ok 23 - C-side strict values in struct
ok 24 - and the int after is 42
ok 25 - nested first is 101
ok 26 - nested second is 77
ok 27 - struct with inlined structs has correct size
1..3
ok 1 - 'class EmptyCStructTest is repr<CStruct> { };' died
ok 2 - right exception type (Exception)
ok 3 - .message matches -> ;; $_? is raw { \#`(Block|108370624229488) ... }
ok 28 - did we throws-like Exception?
ok 29 - Can inline fixed sizes array (1)
ok 30 - Can inline fixed sizes array (2)
ok 31 - Can inline fixed sizes array (3)
=================================================================
==2137==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x6030004701a4 in thread T0
#0 0x7f01fbd2c2ca in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x982ca)
#1 0x7f01fac18901 in MVM_free src/core/alloc.h:40
#2 0x7f01fac1a4ed in gc_cleanup src/6model/reprs/CArray.c:140
#3 0x7f01fac1a589 in gc_free src/6model/reprs/CArray.c:147
#4 0x7f01fab58fab in MVM_gc_collect_free_nursery_uncopied src/gc/collect.c:620
#5 0x7f01fab42825 in finish_gc src/gc/orchestrate.c:241
#6 0x7f01fab4326e in run_gc src/gc/orchestrate.c:413
#7 0x7f01fab43cd8 in MVM_gc_enter_from_allocator src/gc/orchestrate.c:526
#8 0x7f01fab451cc in MVM_gc_allocate_nursery src/gc/allocation.c:35
#9 0x7f01fab44b4d in MVM_gc_allocate src/gc/allocation.h:18
#10 0x7f01fab452a9 in MVM_gc_allocate_zeroed src/gc/allocation.c:52
#11 0x7f01fab45736 in MVM_gc_allocate_object src/gc/allocation.c:89
#12 0x7f01fab9a12d in MVM_repr_alloc_init src/6model/reprconv.c:17
#13 0x7f01fad0a879 in evaluate_guards src/spesh/plugin.c:92
#14 0x7f01fad0aba1 in resolve_using_guards src/spesh/plugin.c:125
#15 0x7f01fad0d866 in MVM_spesh_plugin_resolve src/spesh/plugin.c:426
#16 0x7f01faaa2872 in MVM_interp_run src/core/interp.c:5327
#17 0x7f01fadcfcd4 in MVM_vm_run_file src/moar.c:444
#18 0x4022fc in main src/main.c:302
#19 0x7f01fa00082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#20 0x401268 in _start (/home/dogbert/repos/rakudo/install/bin/moar+0x401268)
0x6030004701a4 is located 4 bytes inside of 20-byte region [0x6030004701a0,0x6030004701b4)
allocated by thread T0 here:
#0 0x7f01fbd2c79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
#1 0x7f01fac1d5ea in MVM_calloc src/core/alloc.h:11
#2 0x7f01fac21209 in initialize src/6model/reprs/CStruct.c:393
#3 0x7f01faa6d947 in MVM_interp_run src/core/interp.c:1857
#4 0x7f01fadcfcd4 in MVM_vm_run_file src/moar.c:444
#5 0x4022fc in main src/main.c:302
#6 0x7f01fa00082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: bad-free ??:0 __interceptor_free
==2137==ABORTING
dogbert@dogbert-VirtualBox ~/repos/rakudo $ cd -
/home/dogbert/repos/rakudo/nqp/MoarVM
dogbert@dogbert-VirtualBox ~/repos/rakudo/nqp/MoarVM $ git diff
diff --git a/src/gc/collect.h b/src/gc/collect.h
index 123d934..f1aec7a 100644
--- a/src/gc/collect.h
+++ b/src/gc/collect.h
@@ -1,6 +1,6 @@
/* The maximum size of the nursery area. Note that since it's semi-space
* copying, we could actually have double this amount allocated per thread. */
-#define MVM_NURSERY_SIZE 4194304
+#define MVM_NURSERY_SIZE (32768 * 4)
/* The nursery size threads other than the main thread start out with. If
* they fill it and trigger a GC run, then it is doubled. If they are
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment