Company
Date Published
Author
-
Word count
2478
Language
English
Hacker News points
None

Summary

In a detailed exploration of debugging challenges in Memgraph, Antonio Andelic recounts the journey of addressing integer overflow and stack overflow issues tied to query timeouts. Initially, a non-deterministic bug caused timeouts to occur unexpectedly due to an overflow in the timer used to measure query timeouts, which was traced back to using a TSC-based timer that failed on specific CPU architectures like AMD Ryzen 7. After switching to POSIX timers to solve the overflow issue, the Memgraph team faced segmentation faults upon integrating jemalloc, attributed to stack overflows exacerbated by the minimal stack size of a helper thread created by the `timer_create` function. This led to a creative solution using `SIGEV_THREAD_ID` to manage signals effectively without discarding jemalloc, showcasing the intricate interplay between software components and the importance of in-depth debugging.