ctu-fgis / 2015-f-citygml

Python library converting CityGML to printable STL
http://geo.fsv.cvut.cz/gwiki/155YFSG
MIT License
9 stars 2 forks source link

Segmentation fault #5

Open bbjolle opened 8 years ago

bbjolle commented 8 years ago

I have been trying to convert the CityGML models of Berlin Mitte but I received a Segmentation fault.

Here is the detailed error message when debugging it with gdb:

`(gdb) run convert.py Starting program: /usr/bin/python3 convert.py Got object file from memory but can't read symbols: File truncated. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault. p2t::Triangle::PointCW (this=this@entry=0x0, point=...) at poly2tri/common/shapes.cc:185 185 if (&point == points_[0]) { (gdb) bt

0 p2t::Triangle::PointCW (this=this@entry=0x0, point=...) at poly2tri/common/shapes.cc:185

1 0x00007ffff47d44b2 in p2t::Triangle::OppositePoint (this=this@entry=0x0, t=..., p=...)

at poly2tri/common/shapes.cc:92                                                                 

2 0x00007ffff47d5caa in p2t::Sweep::FlipScanEdgeEvent (this=this@entry=0x138aa6890, tcx=...,

ep=..., eq=..., flip_triangle=..., t=..., p=...) at poly2tri/sweep/sweep.cc:785

3 0x00007ffff47d5f05 in p2t::Sweep::FlipEdgeEvent (this=0x138aa6890, tcx=..., ep=..., eq=...,

t=0x138a9f650, p=...) at poly2tri/sweep/sweep.cc:741

4 0x00007ffff47d6007 in p2t::Sweep::EdgeEvent (this=, tcx=..., ep=..., eq=...,

triangle=<optimized out>, point=...) at poly2tri/sweep/sweep.cc:146

5 0x00007ffff47d608c in p2t::Sweep::EdgeEvent (this=this@entry=0x138aa6890, tcx=...,

edge=<optimized out>, node=node@entry=0x138ab1370) at poly2tri/sweep/sweep.cc:112

6 0x00007ffff47d6338 in p2t::Sweep::SweepPoints (this=this@entry=0x138aa6890, tcx=...)

at poly2tri/sweep/sweep.cc:55

7 0x00007ffff47d6430 in p2t::Sweep::Triangulate (this=0x138aa6890, tcx=...)

at poly2tri/sweep/sweep.cc:44

8 0x00007ffff47d4bcf in p2t::CDT::Triangulate (this=) at poly2tri/sweep/cdt.cc:52

9 0x00007ffff47d23e8 in pyx_pf_3p2t_3CDT_2triangulate (pyx_v_self=0x7ffff50e5cf0)

at src/p2t.cpp:1749

10 pyx_pw_3p2t_3CDT_3triangulate (pyx_v_self=0x7ffff50e5cf0, unused=)

at src/p2t.cpp:1715

11 0x00007ffff7a6d3cd in call_function (oparg=, pp_stack=0x7fffffffd0f0)

at Python/ceval.c:4210

12 PyEval_EvalFrameEx (f=f@entry=0x7ffff53f3648, throwflag=throwflag@entry=0)

at Python/ceval.c:2829

13 0x00007ffff7a76849 in PyEval_EvalCodeEx (_co=0x7ffff50888a0,

globals=globals@entry=0x7ffff50a7d48, locals=locals@entry=0x0, args=<optimized out>, 
argcount=<optimized out>, kws=<optimized out>, kwcount=0, defs=0x0, defcount=0, 
kwdefs=kwdefs@entry=0x0, closure=0x0) at Python/ceval.c:3578

14 0x00007ffff7a70496 in fast_function (nk=, na=,

n=<optimized out>, pp_stack=0x7fffffffd320, func=<optimized out>) at Python/ceval.c:4334

15 call_function (oparg=, pp_stack=0x7fffffffd320) at Python/ceval.c:4252

16 PyEval_EvalFrameEx (f=f@entry=0x6084b8, throwflag=throwflag@entry=0) at Python/ceval.c:2829

17 0x00007ffff7a70a44 in fast_function (nk=, na=, n=2,

pp_stack=0x7fffffffd490, func=<optimized out>) at Python/ceval.c:4324

18 call_function (oparg=, pp_stack=0x7fffffffd490) at Python/ceval.c:4252

19 PyEval_EvalFrameEx (f=f@entry=0x7ffff50e6a68, throwflag=throwflag@entry=0)

at Python/ceval.c:2829

20 0x00007ffff7a70a44 in fast_function (nk=, na=, n=1,

pp_stack=0x7fffffffd600, func=<optimized out>) at Python/ceval.c:4324

21 call_function (oparg=, pp_stack=0x7fffffffd600) at Python/ceval.c:4252

22 PyEval_EvalFrameEx (f=f@entry=0x7ffff6c55438, throwflag=throwflag@entry=0)

---Type to continue, or q to quit--- at Python/ceval.c:2829

23 0x00007ffff7a764e0 in PyEval_EvalCodeEx (_co=_co@entry=0x7ffff6c17390,

globals=globals@entry=0x7ffff6c523c8, locals=locals@entry=0x7ffff6c523c8, args=args@entry=0x0, 
argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, 
defcount=defcount@entry=0, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0)
at Python/ceval.c:3578

24 0x00007ffff7abacab in PyEval_EvalCode (co=co@entry=0x7ffff6c17390,

globals=globals@entry=0x7ffff6c523c8, locals=locals@entry=0x7ffff6c523c8) at Python/ceval.c:773

25 0x00007ffff7ac6250 in run_mod (mod=mod@entry=0x6e2f70, filename=filename@entry=0x7ffff6b5f370,

globals=globals@entry=0x7ffff6c523c8, locals=locals@entry=0x7ffff6c523c8, 
flags=flags@entry=0x7fffffffd8c0, arena=arena@entry=0x68e2d0) at Python/pythonrun.c:2180

26 0x00007ffff7ac6ab7 in PyRun_FileExFlags (fp=fp@entry=0x6d5af0,

filename_str=filename_str@entry=0x7ffff6c49ce0 "convert.py", start=start@entry=257, 
globals=globals@entry=0x7ffff6c523c8, locals=locals@entry=0x7ffff6c523c8, 
closeit=closeit@entry=1, flags=flags@entry=0x7fffffffd8c0) at Python/pythonrun.c:2133

27 0x00007ffff7ac758b in PyRun_SimpleFileExFlags (fp=fp@entry=0x6d5af0, filename=,

closeit=closeit@entry=1, flags=flags@entry=0x7fffffffd8c0) at Python/pythonrun.c:1606

28 0x00007ffff7ac7984 in PyRun_AnyFileExFlags (fp=fp@entry=0x6d5af0, filename=,

closeit=closeit@entry=1, flags=flags@entry=0x7fffffffd8c0) at Python/pythonrun.c:1292

29 0x00007ffff7ad3d76 in run_file (p_cf=0x7fffffffd8c0, filename=0x6081f0 L"convert.py",

fp=0x6d5af0) at Modules/main.c:319

30 Py_Main (argc=argc@entry=2, argv=argv@entry=0x603010) at Modules/main.c:751

31 0x0000000000400c81 in main (argc=2, argv=) at Modules/python.c:69

(gdb) list 180 } 181 182 // The point counter-clockwise to given point 183 Point* Triangle::PointCW(Point& point) 184 { 185 if (&point == points[0]) { 186 return points[2]; 187 } else if (&point == points[1]) { 188 return points[0]; 189 } else if (&point == points_[2]) { (gdb) print point $1 = (p2t::Point &) @0x138aae1f0: {x = 386410.59375, y = 5822882.5, edgelist = std::vector of length 2, capacity 2 = {0x138ab49d0, 0x138ab38f0}} (gdb) print points[0] Cannot access memory at address 0x8 (gdb) up

1 0x00007ffff47d44b2 in p2t::Triangle::OppositePoint (this=this@entry=0x0, t=..., p=...)

at poly2tri/common/shapes.cc:92

92 Point* ham = PointCW(cw); (gdb) list 87 Point *cw = t.PointCW(p); 88 double x = cw->x; 89 double y = cw->y; 90 x = p.x; 91 y = p.y; 92 Point ham = PointCW(_cw); 93 return PointCW(_cw); 94 } 95 96 // Legalized triangle by rotating clockwise around point(0) (gdb) print *cw $2 = {x = 386410.59375, y = 5822882.5, edge_list = std::vector of length 2, capacity 2 = { 0x138ab49d0, 0x138ab38f0}} (gdb) finish Run till exit from #1 0x00007ffff47d44b2 in p2t::Triangle::OppositePoint (this=this@entry=0x0, t=..., p=...) at poly2tri/common/shapes.cc:92`

The CityGML file is a LOD 2 file. The tool is working perfectiy with the 'Berlin_Alexanderplatz_v1.0.0' example file. Is the source of the error the size of the file? (800MB)

hroncok commented 8 years ago

Most likely the problem is that some polygons are invalid and poly2tri doesn't like that. See the other open issue for similar problem. Franky, I have no idea how to solve that.