PedestrianDynamics / jupedsim

JuPedSim is an open source pedestrian dynamics simulator
http://jupedsim.org
Other
41 stars 28 forks source link

malloc(): smallbin double linked list corrupted #282

Closed chraibi closed 5 years ago

chraibi commented 5 years ago

In Gitlab by @bsmoehring on May 8, 2018, 16:26 [origin]

Summary

Dear all, I am receiving an error in jpscore running the large Alexanderplatz simulation on branch escalator. It happens after 1980 seconds (33 Minutes) of evac_time. Any ideas about this?

Backtrace

Error in ./jpscore': malloc(): smallbin double linked list corrupted: 0x0000000003244f00

backtrace.txt

Inifile + Geometry file to reproduce the bug

jps_geo.xml

jps_ini.xml

Relevant logs, files (inifile and geometry) and/or screenshots

jps_log.P0.dat

chraibi commented 5 years ago

In Gitlab by @chraibi on May 8, 2018, 20:14

./jpscore(_ZN10Simulation24UpdateRoutesAndLocationsEv+0x103)[0x108bced]

UpdateRoutesAndLocations

chraibi commented 5 years ago

In Gitlab by @ArneGraf on May 9, 2018, 12:07

void VoronoiBestVertexRandMax (const std::vector<Point>& discrete_positions, const voronoi_diagram<double>& vd, SubRoom* subroom,
                               double factor, voronoi_diagram<double>::const_vertex_iterator& chosen_it, double& dis    , double radius)
{
     std::vector< voronoi_diagram<double>::const_vertex_iterator > possible_vertices;
     vector<double> partial_sums;
     unsigned long size=0;
     for (auto it = vd.vertices().begin(); it != vd.vertices().end(); ++it){
          Point vert_pos = Point( it->x()/factor, it->y()/factor );
          if( subroom->IsInSubRoom( vert_pos ) )
               if( IsEnoughInSubroom(subroom, vert_pos,radius) )
               {
                    const voronoi_diagram<double>::vertex_type &vertex = *it;
                    const voronoi_diagram<double>::edge_type *edge = vertex.incident_edge();
                    std::size_t index = ( edge->cell() )->source_index();
                    Point p = discrete_positions[index];

                    dis = ( p._x - it->x() )*( p._x - it->x() )   + ( p._y - it->y() )*( p._y - it->y() ) ;
                    dis = dis / factor / factor;
                    possible_vertices.push_back( it );
                    partial_sums.push_back( dis );

                    size = partial_sums.size();
                    if( size > 1 )
                    {
                         partial_sums[ size - 1 ] += partial_sums[ size - 2 ];
                    }
               }
     }
     // partial_sums: [d_0^2,  d_0^2 + d_1^2,  d_0^2 + d_1^2 + d_2^2, ..., \sum_i^{n-1} d_i^3]
     //now we have the vector of possible vertices and weights and we can choose one randomly

     double lower_bound = 0;
     double upper_bound = partial_sums[size-1];

in der letzten Zeile wird ein Seg-Fault geworfen. Kann partial_sums leer sein?

chraibi commented 5 years ago

In Gitlab by @ArneGraf on May 9, 2018, 12:08

(gdb) print partial_sums
$1 = std::vector of length 0, capacity 0
chraibi commented 5 years ago

In Gitlab by @chraibi on May 10, 2018, 12:14

The double if means that size==0 may happen.

Ben: probiere mal before double upper_bound = partial_sums[size-1];

    if(size == 0)                                                                                                             
     {                                                                                                                         
          std:: cout << ">> VoronoiBestVertexRandMax size = " << size << "\n";                                                 
           std:: cout << ">> vd.size = " << vd.size() << "\n" ;                                                                
           return;                                                                                                             
     }     

Ich weiss aber nicht, was dann nach dem return passiert.

chraibi commented 5 years ago

Must be solved by now. I went through this function once.