Permalink
Browse files

Fix missing MVMROOT around an allocation.

This is at least one of the causes of the occasional GC corruption
issues that show up when using Proc::Async (most often with a zeroed
owner error, though depending on timing invalid owner or SEGV could
have happened too).
  • Loading branch information...
1 parent 3736562 commit 4be6b384b802e2c48df077e84f3c1f372dd632dc @jnthn jnthn committed Nov 30, 2016
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/io/procops.c
View
@@ -734,9 +734,12 @@ static void on_alloc(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
static void async_read(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf, SpawnInfo *si,
MVMObject *callback, MVMDecodeStream *ds, MVMuint32 seq_number) {
MVMThreadContext *tc = si->tc;
- MVMObject *arr = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTArray);
- MVMAsyncTask *t = (MVMAsyncTask *)MVM_repr_at_pos_o(tc,
- tc->instance->event_loop_active, si->work_idx);
+ MVMObject *arr;
+ MVMAsyncTask *t;
+ MVMROOT(tc, callback, {
+ arr = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTArray);
+ t = (MVMAsyncTask *)MVM_repr_at_pos_o(tc, tc->instance->event_loop_active, si->work_idx);
+ });
MVM_repr_push_o(tc, arr, callback);
if (nread >= 0) {
MVMROOT(tc, t, {

0 comments on commit 4be6b38

Please sign in to comment.