Skip to content
Snippets Groups Projects
Commit 497fd351 authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

vinyl: fix fiber leak in worker thread

We join a fiber that executes a dump/compaction task only at exit
while we mark all fibers as joinable. As a result, fibers leak, which
eventually leads to a crash:

  src/lib/small/small/slab_arena.c:58: munmap_checked: Assertion `false' failed.

Here's the stack trace:

  munmap_checked
  mmap_checked
  slab_map
  slab_get_with_order
  mempool_alloc
  fiber_new_ex
  fiber_new
  cord_costart_thread_func
  cord_thread_func
  start_thread
  clone

Let's fix this issue by marking a fiber as joinable only at exit, before
joining it. The fiber is guaranteed to be alive at that time, because it
clears vy_worker::task before returning, while we join it only if
vy_worker::task is not NULL.

Fixes commit 43b4342d ("vinyl: fix worker crash at exit").
parent c0102b73
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment