View Issue Details

IDProjectCategoryView StatusLast Update
0002372FreeCADBugpublic2016-01-19 02:06
ReporterChapaikinVA Assigned Towmayer  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04 x64
Fixed in Version0.16 
Summary0002372: Application terminates on attempt to change external geometry from a sketch
Description(Sketcher)

Application terminates on attempt to set a constraint "Height" for a line from an external geometry.
Steps To Reproduce1. Open "Sketch"
2. Select "3-Line"
3. Set a constraint "Vertical distance" / "Height" (default: Shift+V)
Additional InformationOS: Ubuntu 14.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6062 (Git)
Build type: None
Branch: master
Hash: 61e1a5ca2fee4ea7a95965afdbb510a450d46660
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
TagsNo tags attached.
FreeCAD Information

Relationships

has duplicate 0002373 closedwmayer When Measuring in the distance between two external geometry Freecad crashes 

Activities

ChapaikinVA

2015-12-18 09:06

reporter  

Bug_external_2015-12-18 14:55:03.fcstd (Attachment missing)

wmayer

2015-12-24 15:14

administrator   ~0006630

Cannot confirm this behaviour on Ubuntu 12.04 but it crashes on Windows 64-bit (debug mode).

Might be related to the used Eigen3 version. On Ubuntu it's 3.0.5 and on Windows it's 3.2.5.

The callstack is this:
     msvcr90d.dll!_wassert(const wchar_t * expr=0x000007feda2628c0, const wchar_t * filename=0x000007feda262810, unsigned int lineno=19) Line 337 C
> Sketcher_d.pyd!Eigen::SparseMatrixBase<Eigen::CwiseUnaryOp<Eigen::internal::scalar_abs2_op<double>,Eigen::Block<Eigen::SparseMatrix<double,0,int>,-1,1,1> const > >::sum() Line 19 + 0x48 bytes C++
     Sketcher_d.pyd!Eigen::SparseMatrixBase<Eigen::Block<Eigen::SparseMatrix<double,0,int>,-1,1,1> >::squaredNorm() Line 82 + 0x1b bytes C++
     Sketcher_d.pyd!Eigen::SparseMatrixBase<Eigen::Block<Eigen::SparseMatrix<double,0,int>,-1,1,1> >::norm() Line 90 + 0xa bytes C++
     Sketcher_d.pyd!Eigen::SparseQR<Eigen::SparseMatrix<double,0,int>,Eigen::COLAMDOrdering<int> >::factorize(const Eigen::SparseMatrix<double,0,int> & mat={...}) Line 378 + 0x54 bytes C++
     Sketcher_d.pyd!Eigen::SparseQR<Eigen::SparseMatrix<double,0,int>,Eigen::COLAMDOrdering<int> >::compute(const Eigen::SparseMatrix<double,0,int> & mat={...}) Line 102 C++
     Sketcher_d.pyd!Eigen::SparseQR<Eigen::SparseMatrix<double,0,int>,Eigen::COLAMDOrdering<int> >::SparseQR<Eigen::SparseMatrix<double,0,int>,Eigen::COLAMDOrdering<int> >(const Eigen::SparseMatrix<double,0,int> & mat={...}) Line 89 + 0xf bytes C++
     Sketcher_d.pyd!GCS::System::diagnose(GCS::Algorithm alg=DogLeg) Line 3446 + 0x50 bytes C++
     Sketcher_d.pyd!GCS::System::initSolution(GCS::Algorithm alg=DogLeg) Line 949 C++
     Sketcher_d.pyd!Sketcher::Sketch::setUpSketch(const std::vector<Part::Geometry *,std::allocator<Part::Geometry *> > & GeoList=[3](0x00000000091e05d0 {myCurve={...} },0x0000000009250fd0 {myCurve={...} },0x00000000090fc740 {myCurve={...} }), const std::vector<Sketcher::Constraint *,std::allocator<Sketcher::Constraint *> > & ConstraintList=[1](0x00000000090398f0 {Value=10.000000000000000 Type=DistanceY AlignmentType=Undef ...}), int extGeoCount=3) Line 138 C++
     Sketcher_d.pyd!Sketcher::SketchObject::solve(bool updateGeoAfterSolving=true) Line 204 + 0x75 bytes C++
     Sketcher_d.pyd!Sketcher::SketchObjectPy::addConstraint(_object * args=0x0000000003f54e90) Line 271 C++


The assert where is fails prints the message: "you are using a non initialized matrix".

When trying this on older versions 0.13, 0.14 or 0.15 an error dialog comes up explaining that it's not possible to set a vertical (length) constraint on an external geometry.

In 0.16 this dialog doesn't come up any more and I wonder why. So, it's clearly a regression independent of the used Eigen version.

wmayer

2015-12-24 15:34

administrator   ~0006631

This is the link of the changes that introduced non-driving constraints. This means it's intended behaviour to allow to add constraints to external geometries.
https://github.com/FreeCAD/FreeCAD/commit/bc85670ce955e0cfaa0aecce848017be1d4db10a#diff-c4b9037af907a0a4082031a362f281c4L1271

So, it falls back to Eigen and we have to determine if the matrix is valid before applying Eigen stuff on it.

wmayer

2015-12-24 16:02

administrator   ~0006633

For testing purposes I switched back to Eigen 3.0.5 on Windows and now it works. So, it's definitely related to the used version of Eigen. This means we have to a workaround for this...

wmayer

2015-12-24 16:44

administrator   ~0006634

When debugging through then inside System::diagnose we have "clist" with a single element and an empty "plist". So, this means we get a 1 x 0 matrix which doesn't make sense.
(Btw, when just adding an external constraint the matrix is a 0 x 0 matrix.)

Now, with Eigen3.0.5 it doesn't crash because it executes the path of the dense matrix handling while Eigen3.2.x is goes the path of the sparse matrix handling.

So, it's a bug in FreeCAD and the function System::diagnose must return immediately when clist or plist is empty.

Related Changesets

FreeCAD: master 632eaead

2015-12-25 09:47:25

wmayer

Details Diff
+ fixes 0002372: Application terminates on attempt to change external geometry from a sketch
+ fixes 0002373: When Measuring in the distance between two external geometry Freecad crashes
Affected Issues
0002372, 0002373
mod - src/Mod/Sketcher/App/planegcs/GCS.cpp Diff File

Issue History

Date Modified Username Field Change
2015-12-18 09:06 ChapaikinVA New Issue
2015-12-18 09:06 ChapaikinVA File Added: Bug_external_2015-12-18 14:55:03.fcstd
2015-12-20 23:13 yorik Relationship added related to 0002373
2015-12-24 15:14 wmayer Note Added: 0006630
2015-12-24 15:14 wmayer Assigned To => abdullah
2015-12-24 15:14 wmayer Status new => assigned
2015-12-24 15:34 wmayer Note Added: 0006631
2015-12-24 15:49 wmayer Relationship replaced has duplicate 0002373
2015-12-24 16:02 wmayer Note Added: 0006633
2015-12-24 16:44 wmayer Note Added: 0006634
2015-12-25 09:38 wmayer Changeset attached => FreeCAD Master master 632eaead
2015-12-25 09:38 wmayer Assigned To abdullah => wmayer
2015-12-25 09:38 wmayer Status assigned => closed
2015-12-25 09:38 wmayer Resolution open => fixed
2016-01-19 02:06 yorik Fixed in Version => 0.16