cmu-db / noisepage

Self-Driving Database Management System from Carnegie Mellon University
https://noise.page
MIT License
1.74k stars 502 forks source link

StatisticsRegistry Memory Leak on SIGINT #711

Closed apavlo closed 4 years ago

apavlo commented 4 years ago

ASAN is complaining that we are leaking memory from the StatisticsRegistry when we send a SIGINT (CTRL+C) to the main DBMS process:

$ ./debug/terrier 
[2020-01-28 22:15:47.126] [network_logger] [info] Listening on port 15721
[2020-01-28 22:15:58.912] [network_logger] [info] Server Closed

=================================================================
==12318==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7f2ba3ba7458 in operator new(unsigned long) (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xe0458)
    #1 0x55cd09756910 in terrier::common::StatisticsRegistry::StatisticsRegistry() (/home/pavlo/Documents/Peloton/Github/terrier/build/debug/terrier+0x8d5910)
    #2 0x55cd0975699b in std::_MakeUniq<terrier::common::StatisticsRegistry>::__single_object std::make_unique<terrier::common::StatisticsRegistry>() (/home/pavlo/Documents/Peloton/Github/terrier/build/debug/terrier+0x8d599b)
    #3 0x55cd0973bb29 in main /home/pavlo/Documents/Peloton/Github/terrier/src/main/terrier.cpp:73
    #4 0x7f2ba1ebeb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

SUMMARY: AddressSanitizer: 16 byte(s) leaked in 1 allocation(s).

How to Reproduce

cmake -DCMAKE_BUILD_TYPE=debug -DTERRIER_BUILD_BENCHMARKS=ON -DTERRIER_USE_ASAN=yes ..

Terminal 1 Start the server

$ ./debug/terrier

Terminal 2 Kill the server with a SIGINT

$ pkill -2 terrier
mbutrovich commented 4 years ago

This is already fixed in #705.

mbutrovich commented 4 years ago

I am curious why the JUnit tests don’t report this ASAN failure though.

rohan2734 commented 4 years ago

This bug doesnt seem it is for a beginner : (

apavlo commented 4 years ago

Fixed in #705