Skip to content

Memory Allocation Failure in TempResult::doJoin #147

@ting668

Description

@ting668
  • Problem Description
    During the execution of gquery with the query file poc_03.sql on the lubm7 database, the program terminates abnormally due to a memory allocation failure. The operator new fails to allocate memory for expanding a std::vector during a JOIN operation in the query evaluation process.

  • Prerequisites

bin/gbuild -db lubm7 -f ./data/lubm/lubm.nt
Test case:

poc_03.sql

  • Reproduction Steps && Error Log
ting668@nuc:~/gStore$ valgrind ./bin/gquery -db lubm7 -q ./poc/poc_03.sql
==14169== Memcheck, a memory error detector
==14169== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==14169== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==14169== Command: ./bin/gquery -db lubm7 -q ./poc/poc_03.sql
==14169==
[==================================================] Set pre map, pre num = 5
[==================================================] Load cache done!
[==================================================] Set pre map, pre num = 17
[==================================================] Load cache done!
**14169** new/new[] failed and should throw an exception, but Valgrind
**14169**    cannot throw exceptions and so is aborting instead.  Sorry.
==14169==    at 0x4848390: VALGRIND_PRINTF_BACKTRACE (valgrind.h:6815)
==14169==    by 0x4849194: operator new(unsigned long) (vg_replace_malloc.c:483)
==14169==    by 0x43BF8C: UnknownInlinedFun (new_allocator.h:127)
==14169==    by 0x43BF8C: UnknownInlinedFun (alloc_traits.h:464)
==14169==    by 0x43BF8C: UnknownInlinedFun (stl_vector.h:346)
==14169==    by 0x43BF8C: std::vector<TempResult::ResultPair, std::allocator<TempResult::ResultPair> >::_M_default_append(unsigned long) (vector.tcc:635)
==14169==    by 0x657192: UnknownInlinedFun (stl_vector.h:940)
==14169==    by 0x657192: TempResult::doJoin(TempResult&, TempResult&) (src/Query/TempResult.cpp:365)
==14169==    by 0x68242A: TempResultSet::doJoin(TempResultSet&, TempResultSet&, StringIndex*, Varset&, KVstore*) (src/Query/TempResult.cpp:1466)
==14169==    by 0x3B6936: GeneralEvaluation::queryEvaluation(int) (src/Query/GeneralEvaluation.cpp:682)
==14169==    by 0x3B1D70: GeneralEvaluation::queryEvaluation(int) (src/Query/GeneralEvaluation.cpp:461)
==14169==    by 0x3A499A: GeneralEvaluation::doQuery() (src/Query/GeneralEvaluation.cpp:341)
==14169==    by 0x2F8E00: Database::query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, ResultSet&, _IO_FILE*, bool, bool, std::shared_ptr<Transaction>) (src/Database/Database.cpp:1965)
==14169==    by 0x2E1ABE: main (src/Main/gquery.cpp:140)
==14169==
==14169== HEAP SUMMARY:
==14169==     in use at exit: 67,101,650 bytes in 783,518 blocks
==14169==   total heap usage: 1,896,407 allocs, 1,112,889 frees, 125,152,756 bytes allocated
==14169==
==14169== LEAK SUMMARY:
==14169==    definitely lost: 0 bytes in 0 blocks
==14169==    indirectly lost: 0 bytes in 0 blocks
==14169==      possibly lost: 1,536 bytes in 4 blocks
==14169==    still reachable: 67,100,114 bytes in 783,514 blocks
==14169==                       of which reachable via heuristic:
==14169==                         newarray           : 8,916,968 bytes in 9 blocks
==14169==         suppressed: 0 bytes in 0 blocks
==14169== Rerun with --leak-check=full to see details of leaked memory
==14169==
==14169== For lists of detected and suppressed errors, rerun with: -s
==14169== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
ting668@nuc:~/gStore$

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions