[Lemon-user] Issue with ListDigraph::NodeMaps

Alpar Juttner alpar at cs.elte.hu
Sat Jun 24 09:28:20 CEST 2017


Hi,
I doubt if this is a bug in LEMON itself (but it is not fully
impossible).
The typical reason for this kind of bugs is that a previous vector
overindexing/underindexing operation destroys the datastructure of the
dynamic memory management.
It is strange that Valgrind does not report this previous memory
overrun, but it is possible.
Note that - for performance reasons - neither STL nor LEMON do any
runtime rangecheck by default.
But this can be turned on by defining  _GLIBCXX_DEBUG (for GCC) and
LEMON_DEBUG (for LEMON).
If you still unable to resolve the problem and do not want to post the
full code publicly, please contact me privately. I'm happy to help to
locate the problem.
Best regards,
Alpár
 
On Mon, 2017-06-19 at 16:43 +0200, Marco Blanco wrote:
> Dear Lemon Team,
> 
> unfortunately, we could not reproduce the error in a small example,
> and our code is too big and dependent on several files and local
> settings to include. Below is the constructor for the Query2D object,
> I hope that helps...
> 
> Kind regards,
> Marco
> 
> 
> Query2D::Query2D(const Graph2D& g2D) :
>     _bg(&g2D),
>     G(g2D.G),
>     _settled(G,0),
>     _id(G, std::numeric_limits<size_t>::max() ),
>     _nodeType(G,0)
>     _potential(G,0)
> {};
> 
> Am 14.06.2017 um 08:37 schrieb Péter Kovács:
> > Dear Marco, 
> > 
> > Could you send a self-contained code example for reproducing the
> > issue? I miss e.g. the implementation of the constructor of Query2D
> > (where constructors of the node maps should be called). 
> > 
> > Regards, 
> > Péter 
> > 
> > 
> > 
> > > Dear Lemon-Team, 
> > > 
> > > I've run across a problem with your ListDigraph::NodeMapswhich I
> > > can't 
> > > solve on my own. 
> > > 
> > > Unfortunately, as the code is rather intricate, I find myself
> > > unable to 
> > > provide a minimal example, but the simplified structure is as
> > > follows: 
> > > The function testcreates a Graph2Dwith an underlying 
> > > lemon::ListDigraphobject and calls a shortestPathwrapper. This 
> > > shortestPathfunction creates a Query2Dobject, which knows the
> > > underlying 
> > > ListDigraph, and keeps a few NodeMaps(see below). The first three
> > > NodeMapsnever caused an issue, but when I implemented the fourth
> > > one 
> > > called _potential, the destructor of Graph2Dthrows a segfault.
> > > Note that 
> > > none of the destructors are implemented by me, I use the standard
> > > implicit destructors. 
> > > 
> > > In the attached valgrind output, I could trace the segfault down
> > > to the 
> > > clear()function in alteration_notifier.h -- yet, as three 
> > > NodeMapsalready exist and seemingly work fine, I'm at a loss as
> > > to why 
> > > this segfault occurs. I'm grateful for any support you can
> > > provide! 
> > > 
> > > Regards, 
> > > Marco 
> > > 
> > > 
> > > void test(const Problem& problem) 
> > > { 
> > >     Graph2D g2D(problem); 
> > >     g2D.shortestPath("from","to"); 
> > > } 
> > > 
> > > class Graph2D 
> > > { 
> > > public: 
> > >     Graph2D(const Problem& problem); 
> > >     lemon::ListDigraph G; 
> > > 
> > >     void shortestPath(const std::string& from, const std::string&
> > > to) 
> > >     lemon::ListDigraph::Node getNode(const std::string& name); 
> > > } 
> > > 
> > > void Graph2D::shortestPath(const std::string& from, const
> > > std::string& to) 
> > > { 
> > >     Query2D query(*this); 
> > > 
> > >     lemon::ListDigraph::Node s = getNode(from); 
> > >     lemon::ListDigraph::Node t = getNode(to); 
> > > 
> > >     query.run(s,t); 
> > > } 
> > > 
> > > 
> > > class Query2D 
> > > { 
> > > public: 
> > >     Query2D(const Graph2D& g2D); 
> > > 
> > >     const Graph2D* const _bg; 
> > >     const lemon::ListDigraph& G; 
> > > 
> > >     void run(lemon::ListDigraph::Node s, lemon::ListDigraph::Node
> > > t); 
> > > 
> > >     /** The following three NodeMaps have been here for a long
> > > time and 
> > > never caused any issues */ 
> > >     lemon::ListDigraph::NodeMap<short> _settled; 
> > >     lemon::ListDigraph::NodeMap<size_t> _id; 
> > >     lemon::ListDigraph::NodeMap<short> _nodeType; 
> > > 
> > >     /** This map causes trouble. If left in, it causes the
> > > attached 
> > > SIGSEGV (even though it is never used after initialisation!), if 
> > > commented out, everything works nice and smooth */ 
> > >     lemon::ListDigraph::NodeMap<double> _potential; 
> > > } 
> > > 
> > > 
> > > _______________________________________________ 
> > > Lemon-user mailing list 
> > > Lemon-user at lemon.cs.elte.hu 
> > > http://lemon.cs.elte.hu/mailman/listinfo/lemon-user 
> > > 
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lemon.cs.elte.hu/pipermail/lemon-user/attachments/20170624/2fdde630/attachment.html>


More information about the Lemon-user mailing list