Skip to content

Destructor of RangeSearchResultHandler may throw an exception? #2948

@megumin9

Description

@megumin9

In faiss/utils/distances.cpp function ‘range_search_inner_product’, the destructor of RangeSearchResultHandler will be called, then function 'RangeSearchPartialResult::merge' and function 'RangeSearchResult::do_allocation' will be executed when partial_results.size() > 0. 'RangeSearchResult::do_allocation' may throw an exception, which will cause a crash. Is this intended? If not intended, exceptions can be caught to prevent the crash as follows:

if (partial_results.size() > 0) {
RangeSearchPartialResult::merge(partial_results);
}

--->

try {
if (partial_results.size() > 0) {
RangeSearchPartialResult::merge(partial_results);
}
} catch (const FaissException& e){
// log...
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions