Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Last active June 21, 2021 18:32
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/d52fb5d1850c8679958865f7e5e8b03e to your computer and use it in GitHub Desktop.
Save dogbert17/d52fb5d1850c8679958865f7e5e8b03e to your computer and use it in GitHub Desktop.
GC related panic
ok 19 - found π
# Completion: bare word
ok 20 - found τ
# Completion: bare word
ok 21 - found ∞
1..21
Thread 1 "rakudo-m" hit Breakpoint 2, __GI__exit (status=status@entry=0) at ../sysdeps/unix/sysv/linux/_exit.c:27
27 ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff71f6700 (LWP 21121)]
[New Thread 0x7ffff5ae9700 (LWP 21122)]
[New Thread 0x7ffff52e6700 (LWP 21123)]
Thread 1 "rakudo-m" hit Breakpoint 1, MVM_panic (exitCode=0, messageFormat=0x0) at src/core/exceptions.c:853
853 MVM_NO_RETURN void MVM_panic(MVMint32 exitCode, const char *messageFormat, ...) {
(gdb) bt
#0 MVM_panic (exitCode=0, messageFormat=0x0) at src/core/exceptions.c:853
#1 0x00007ffff7929b86 in MVM_serialization_finish_deserialize_method_cache (tc=0x55555555a1a0, st=0x555555ab6f00) at src/6model/serialization.c:3174
#2 0x00007ffff7912b9d in get_method_cache (tc=0x55555555a1a0, st=0x555555ab6f00) at src/6model/6model.c:20
#3 0x00007ffff79133bf in MVM_6model_find_method (tc=0x55555555a1a0, obj=0x555555ac39a0, name=0x555555b7f9d0, res=0x555557ed0608, throw_if_not_found=1) at src/6model/6model.c:111
#4 0x00007ffff780cb60 in MVM_interp_run (tc=0x55555555a1a0, initial_invoke=0x7ffff79c43b6 <toplevel_initial_invoke>, invoke_data=0x5555555bdcc8, outer_runloop=0x0) at src/core/interp.c:1885
#5 0x00007ffff79c453c in MVM_vm_run_file (instance=0x555555559660, filename=0x5555555595e0 "/home/dogbert/.rakudobrew/versions/moar-master/install/share/perl6/runtime/perl6.moarvm") at src/moar.c:504
#6 0x00005555555558e8 in main ()
(gdb) f 1
#1 0x00007ffff7929b86 in MVM_serialization_finish_deserialize_method_cache (tc=0x55555555a1a0, st=0x555555ab6f00) at src/6model/serialization.c:3174
3174 MVM_ASSIGN_REF(tc, &(st->header), st->method_cache, cache);
(gdb) l
3169
3170 /* Deserialize what we need. */
3171 cache = MVM_serialization_read_ref(tc, sr);
3172 if (sr->working == 1)
3173 work_loop(tc, sr);
3174 MVM_ASSIGN_REF(tc, &(st->header), st->method_cache, cache);
3175
3176 /* Clear up. */
3177 MVM_gc_allocate_gen2_default_clear(tc);
3178 sr->working--;
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7ffff727c440 (LWP 21120) "rakudo-m" 0x00007ffff7929b86 in MVM_serialization_finish_deserialize_method_cache (tc=0x55555555a1a0, st=0x555555ab6f00) at src/6model/serialization.c:3174
2 Thread 0x7ffff71f6700 (LWP 21121) "spesh optimizer" futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555555ab118) at ../sysdeps/nptl/futex-internal.h:183
3 Thread 0x7ffff5ae9700 (LWP 21122) "rakudo-m" futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555555559744) at ../sysdeps/nptl/futex-internal.h:183
4 Thread 0x7ffff52e6700 (LWP 21123) "rakudo-m" 0x00007ffff74d53bf in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=0x7ffff52e4500, rem=0x7ffff52e4500) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
(gdb)
----- changes in MoarVM in order to repro
dogbert@dogbert-VirtualBox:~/.rakudobrew/versions/moar-master/nqp/MoarVM$ git diff
diff --git a/src/core/fixedsizealloc.c b/src/core/fixedsizealloc.c
index cea39f925..a1faa0054 100644
--- a/src/core/fixedsizealloc.c
+++ b/src/core/fixedsizealloc.c
@@ -10,7 +10,7 @@
* behavior. */
/* Turn this on to switch to a mode where we debug by size. */
-#define FSA_SIZE_DEBUG 0
+#define FSA_SIZE_DEBUG 1
#if FSA_SIZE_DEBUG
typedef struct {
size_t alloc_size;
diff --git a/src/gc/collect.h b/src/gc/collect.h
index 153805096..9b3385e1b 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 (65536 * 2)
/* 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
diff --git a/src/gc/debug.h b/src/gc/debug.h
index 91d833abd..20735652d 100644
--- a/src/gc/debug.h
+++ b/src/gc/debug.h
@@ -4,7 +4,7 @@
* 2 = Checks on every object register access (slow)
* 3 = Collects garbage on every allocation
*/
-#define MVM_GC_DEBUG 0
+#define MVM_GC_DEBUG 1
#if MVM_GC_DEBUG
#define MVM_ASSERT_NOT_FROMSPACE(tc, c) do { \
diff --git a/src/gc/roots.h b/src/gc/roots.h
index 39366bd23..314663268 100644
--- a/src/gc/roots.h
+++ b/src/gc/roots.h
@@ -1,5 +1,5 @@
/* Set this flag to debug temporary root pushes/pops. */
-#define MVM_TEMP_ROOT_DEBUG 0
+#define MVM_TEMP_ROOT_DEBUG 1
/* The number of temp roots we start out with per thread (and so can rely on
* always having). */
diff --git a/src/moar.h b/src/moar.h
index 7d9c445b6..8de4193a8 100644
--- a/src/moar.h
+++ b/src/moar.h
@@ -98,7 +98,7 @@ typedef double MVMnum64;
#endif
/* Hashes */
-#define HASH_DEBUG_ITER 0
+#define HASH_DEBUG_ITER 1
#define MVM_HASH_RANDOMIZE 1
#define MVM_HASH_MAX_PROBE_DISTANCE 255
#define MVM_HASH_INITIAL_BITS_IN_METADATA 5
diff --git a/src/spesh/usages.h b/src/spesh/usages.h
index 499a55d1f..af94d21ff 100644
--- a/src/spesh/usages.h
+++ b/src/spesh/usages.h
@@ -1,5 +1,5 @@
/* Option to enable checking of define/use chains for debugging purposes. */
-#define MVM_SPESH_CHECK_DU 0
+#define MVM_SPESH_CHECK_DU 1
/* Usage information, which is held per SSA written register. */
struct MVMSpeshUsages {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment