Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BE crashed when index_type is hnsw and M is 1 #55055

Open
ZiheLiu opened this issue Jan 14, 2025 · 0 comments · May be fixed by #55123
Open

BE crashed when index_type is hnsw and M is 1 #55055

ZiheLiu opened this issue Jan 14, 2025 · 0 comments · May be fixed by #55123
Labels
type/bug Something isn't working

Comments

@ZiheLiu
Copy link
Contributor

ZiheLiu commented Jan 14, 2025

Steps to reproduce the behavior (Required)

CREATE TABLE t_test_vector_table (
    id bigint(20) NOT NULL COMMENT "",
    vector ARRAY<FLOAT> NOT NULL COMMENT "",
    INDEX index_vector (vector) USING VECTOR (
        "index_type" = "hnsw", 
        "dim"="4", 
        "metric_type" = "l2_distance", 
        "is_vector_normed" = "false", 
        "M" = "1", -- If set to 2, then we will not encounter this issue.
        "efconstruction" = "2"
    )
) ENGINE=OLAP
DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES (
    "replication_num" = "1"
);

insert into t_test_vector_table values 
            (1, [1.0, 2.0, 3.0, 4.0]),
            (2, [1.1, 2.1, 3.1, 4.1]),
            (3, [1.2, 2.2, 3.2, 4.2]),
            (4, [10.0, 10.0, 10.0, 10.0]),
            (5, [10.1, 10.1, 10.1, 10.1]),
            (6, [10.2, 10.2, 10.2, 10.2]),
            (7, [5.0, 5.0, 5.0, 5.0]),
            (8, [5.1, 5.1, 5.1, 5.1]),
            (9, [0.5, 0.5, 0.5, 0.5]),
            (10, [0.6, 0.6, 0.6, 0.6]) ;

Real behavior (Required)

The process of BE is killed by the system due to OOM, and tenann allocates large memory lots of times as follows.

W20250114 13:47:51.076904 140145512130304 mem_hook.cpp:103] large memory alloc, query_id:00000000-0000-0000-0000-000000000000 instance: 00000000-0000-0000-0000-000000000000 acquire:68719476736 bytes, stack:
    @          0x3dfb311  starrocks::get_stack_trace[abi:cxx11]()
    @          0x3d56164  malloc
    @          0xea90368  operator new(unsigned long)
    @          0xd6c866d  faiss::(anonymous namespace)::hnsw_add_vertices(faiss::IndexHNSW&, unsigned long, unsigned long, float const*, bool, bool)
    @          0xd5d463d  tenann::FaissIndexBuilder::AddImpl(std::vector<tenann::SeqView, std::allocator<tenann::SeqView> > const&, long const*, unsigned char const*)
    @          0xd5d3e63  tenann::FaissIndexBuilder::Add(std::vector<tenann::SeqView, std::allocator<tenann::SeqView> > const&, long const*, unsigned char const*, bool)
    @          0x793698a  starrocks::TenAnnIndexBuilderProxy::add(starrocks::Column const&)
    @          0x792f83a  starrocks::VectorIndexWriter::_append_data(starrocks::Column const&, unsigned long)
    @          0x79309f1  starrocks::VectorIndexWriter::append(starrocks::Column const&)
    @          0x78ef2a8  starrocks::ArrayColumnWriter::append(starrocks::Column const&)
    @          0x6f2dce9  starrocks::SegmentWriter::append_chunk(starrocks::Chunk const&)
    @          0x79590c8  starrocks::HorizontalRowsetWriter::_flush_chunk(starrocks::Chunk const&, starrocks::SegmentPB*)
    @          0x79592a8  starrocks::HorizontalRowsetWriter::flush_chunk(starrocks::Chunk const&, starrocks::SegmentPB*)
    @          0x6fe9d9a  starrocks::MemTableRowsetWriterSink::flush_chunk(starrocks::Chunk const&, starrocks::SegmentPB*, bool)
    @          0x70337d8  starrocks::MemTable::flush(starrocks::SegmentPB*, bool)
    @          0x6d5d63a  starrocks::FlushToken::_flush_memtable(starrocks::MemTable*, starrocks::SegmentPB*, bool)
    @          0x6d5ebdf  starrocks::MemtableFlushTask::run()
    @          0x3e22448  starrocks::ThreadPool::dispatch_thread()
    @          0x3e18780  starrocks::Thread::supervise_thread(void*)
    @     0x7f7649895ea5  start_thread
    @     0x7f76474c6b0d  __clone

StarRocks version (Required)

main e446727

@ZiheLiu ZiheLiu added the type/bug Something isn't working label Jan 14, 2025
@ZiheLiu ZiheLiu linked a pull request Jan 16, 2025 that will close this issue
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant