Opened 4 years ago
Closed 4 years ago
#638 closed defect (fixed)
Segmentation fault on matching for SimpleGraph
Reported by: | Fabio Durastante | Owned by: | Alpar Juttner |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.4 release |
Component: | core | Version: | release branch 1.3 |
Keywords: | stack overflow, matching | Cc: | |
Revision id: |
Description
Hi,
I encounter a Segmentation fault when running the MaxWeightedMatching? algorithm for a SmartGraph? object. Valgrind tells me that there is a stack-overflow. Compiling with GCC version 7.5.0 and -fsanitize=address I get pointed to an error in
#7 0x55d64a51fea8 in void lemon::HeapUnionFind<double, lemon::GraphExtender<lemon::SmartGraphBase>::NodeMap<int>, std::less<double> >::split<std::back_insert_iterator<std::vector<int, std::allocator<int> > > >(int, std::back_insert_iterator<std::vector<int, std::allocator<int> > >) /auxlibs/include/lemon/unionfind.h:1563 #8 0x55d64a542d2e in lemon::MaxWeightedMatching<lemon::SmartGraph, lemon::GraphExtender<lemon::SmartGraphBase>::EdgeMap<double> >::extractBlossom(int, lemon::SmartGraphBase::Node const&, lemon::SmartGraphBase::Arc const&) /auxlibs/include/lemon/matching.h:1518
I am attaching a matrix market file with the weighted adjacency graph of the matrix causing the error.
Thank you very much.
Attachments (3)
Change History (8)
Changed 4 years ago by
Attachment: | weightmatrix_256005x256005.tar.xz added |
---|
comment:1 Changed 4 years ago by
This SEGFAULT is caused by the recursive implementation of the extractBlossom() function. I could reproduce the problem and setting ulimit -s 65536
is a proper workaround.
However, the right solution is to refactor the code to a non-recursive version.
Changed 4 years ago by
Attachment: | 51691ae2d947.patch added |
---|
comment:2 Changed 4 years ago by
A like this patch. Can I just merge into the main branch? Is there any remaining issue with it?
comment:3 Changed 4 years ago by
Hi! Sorry for the delay in the answer. I have tried the patch on several test cases that were giving me the same issue, and it seems to be resolved. Thank you very much for the effort!
Changed 4 years ago by
Attachment: | 008bc4c6ed4a.patch added |
---|
comment:4 Changed 4 years ago by
I have just created an almost identical patch [008bc4c6ed4a], but I think the new patch is slightly more efficient (However, the blossom extraction is not the most critical part of this algorithm).
Otherwise, it looks to be OK to merge the patch to the main branch.
comment:5 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The second version of the patch is in the main branch as [c6aa2cc1af04]. Thanks.
Weighted adjacency matrix of the graph in matrix market format