View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001292 | FreeCAD | Bug | public | 2013-10-30 09:11 | 2013-11-05 20:00 |
Reporter | shoogen | Assigned To | wmayer | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 0.13 | ||||
Fixed in Version | 0.14 | ||||
Summary | 0001292: Crash propably in MeshPart | ||||
Description | OS: Windows 7 Platform: 32-bit Version: 0.13.1828 Python version: 2.6.2 Qt version: 4.5.2 Coin version: 3.1.0 SoQt version: 1.4.1 OCC version: 6.3.0 the python script crashes FreeCAD if obj.isDerivedFrom('Part::Feature'): #mesh the shape import MeshPart params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD") objs.append(obj) meshes.append(MeshPart.meshFromShape(obj.Shape,params.GetFloat(\ 'meshmaxlength',100.0), params.GetFloat('meshmaxarea',0.001),\ params.GetFloat('meshlocallen',5.0),\ params.GetFloat('meshdeflection',0.1))) In ntdll.dll!_NtFreeVirtualMemory@16 the final RET causes a protection fault. I don't have a stack trace, as i don't have a stack | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
I tried to repoduce this on OS: Windows 7 Platform: 32-bit Version: 0.14.2690 (Git) Branch: (no branch) Hash: 992712602c67b3310689c526f08c620f382f546a Python version: 2.6.2 Qt version: 4.5.2 Coin version: 3.1.0 SoQt version: 1.4.1 OCC version: 6.5.1 I needed to rename MEFISTO2d.dll to MEFISTO2.dll to load the MeshPart module. There is no crash, but instead i get invalid meshes. >>> MeshPart.meshFromShape(App.ActiveDocument.Sphere.Shape) Mesh: [0 Faces, 0 Edges, 23 Points] >>> MeshPart.meshFromShape(App.ActiveDocument.Cone.Shape) Mesh: [0 Faces, 0 Edges, 49 Points] |
|
the same commands on the 0.13 windows stable trigger the crash |
|
I get nowhere a crash. |
|
Thanks for trying that out, werner If don't load my OpenSCAD WB or import the OpenSCADUtils.py i can use MeshPart.meshFromShape. It seems to involve WB loading. I guess it is something like a broken Qt Resource file. the only point in which my installation differ from the 0.13 is the OpenSCAD module. git@github.com:5263/FreeCAD.git dev-openscad And python code should not introduce crash bugs. |
|
Now I got it crashing in debug mode but without loading the OpenSCAD wb. It happens inside StdMeshers_MEFISTO_2D::Compute() at the end when freeing the memory. |
|
This is the last stack frame. I haven't figured out where to find the previous one. But guess that this is related to SMESH. Call stack of main thread Stack Data Procedure Called from Frame 00C6A9E0 77B52B4C ntdll.NtFreeVirtualMemory ntdll.77B52B47 00C6AA00 00C6AA04 77B60511 ntdll.77B52B31 ntdll.RtlCreateHeap+20D 00C6AAD8 6DBE8E7B ??? AcXtrnal.6DBE8E78 00C6AAD4 00C6AB00 772854EC AcXtrnal.6DBE94A8 KERNELBASE.HeapCreate+4A 00C6AAFC 00C6AB24 09EB525A kernel32.HeapCreate TKService.09EB5254 00C6AB20 00C6AB90 09ED87CA TKService.09EB5210 TKService.09ED87C5 09F607CC |
|
The crash happens at these two lines: if (uvst != NULL) delete[]uvst; if (nust != NULL) delete[]nust; The pointers got initialized inside the function aptrte. |
|
When calling this from the Python console the stack frame is: ntdll.dll!00000000779ff0c1() [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] ntdll.dll!00000000779e8331() ntdll.dll!000000007796fb11() KernelBase.dll!000007fefdaa3afa() > msvcr90d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x000000000fd6c520) Line 2103 C++ msvcr90d.dll!_free_dbg_nolock(void * pUserData=0x000000000fd6c520, int nBlockUse=-17891602) Line 1317 + 0xa bytes C++ msvcr90d.dll!_free_dbg(void * pUserData=0x000000000fd6c520, int nBlockUse=-17891602) Line 1258 + 0xe bytes C++ msvcr90d.dll!operator delete(void * pUserData=0x000000000fd6c520) Line 54 + 0x12 bytes C++ msvcr90d.dll!operator delete[](void * p=0x000000000fd6c520) Line 22 C++ StdMeshersd.dll!StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh={...}, const TopoDS_Shape & aShape={...}) Line 283 C++ SMESHd.dll!SMESH_subMesh::ComputeStateEngine(int event=1) Line 1373 + 0x27 bytes C++ SMESHd.dll!SMESH_Gen::Compute(SMESH_Mesh & aMesh={...}, const TopoDS_Shape & aShape={...}, const bool anUpward=true, const MeshDimension aDim=MeshDim_3D, std::set<int,std::less<int>,std::allocator<int> > * aShapesId=[...]()) Line 176 C++ SMESHd.dll!SMESH_Gen::Compute(SMESH_Mesh & aMesh={...}, const TopoDS_Shape & aShape={...}, const bool anUpward=false, const MeshDimension aDim=MeshDim_3D, std::set<int,std::less<int>,std::allocator<int> > * aShapesId=[...]()) Line 283 + 0x38 bytes C++ MeshPart_d.pyd!MeshPart::Mesher::createMesh() Line 128 + 0x5d bytes C++ MeshPart_d.pyd!meshFromShape(_object * self=0x0000000000000000, _object * args=0x0000000012bd92c8) Line 156 + 0x3a bytes C++ python26_d.dll!PyCFunction_Call(_object * func=0x0000000012bd5678, _object * arg=0x0000000012bd92c8, _object * kw=0x0000000000000000) Line 81 + 0xe bytes C python26_d.dll!call_function(_object * * * pp_stack=0x00000000141673b8, int oparg=314418005) Line 3706 + 0xdb bytes C python26_d.dll!PyEval_EvalFrameEx(_frame * f=0x00000000141673b8, int throwflag=80728800) Line 2391 C python26_d.dll!PyEval_EvalCodeEx(PyCodeObject * co=0x0000000000000000, _object * globals=0x0000000004d81ad8, _object * locals=0x0000000000000000, _object * * args=0x00000000002b11b8, int argcount=0, _object * * kws=0x0000000000000000, int kwcount=0, _object * * defs=0x0000000000000000, int defcount=0, _object * closure=0x0000000000000000) Line 2968 + 0xf bytes C python26_d.dll!PyEval_EvalCode(PyCodeObject * co=0x0000000004d81ad8, _object * globals=0xcccccccccccccccc, _object * locals=0xcccccccccccccccc) Line 528 C FreeCADGuiD.dll!Gui::InteractiveInterpreter::runCode(PyCodeObject * code=0x000000000597d8c8) Line 298 + 0x18 bytes C++ FreeCADGuiD.dll!Gui::InteractiveInterpreter::runSource(const char * source=0x00000000133b7d08) Line 278 C++ FreeCADGuiD.dll!Gui::InteractiveInterpreter::push(const char * line=0x000000000610e268) Line 322 + 0x4d bytes C++ FreeCADGuiD.dll!Gui::PythonConsole::runSource(const QString & line={...}) Line 735 + 0x61 bytes C++ FreeCADGuiD.dll!Gui::PythonConsole::keyPressEvent(QKeyEvent * e=0x0000000000b67a10) Line 538 C++ QtGuid4.dll!QWidget::event(QEvent * event=0x0000000000b67a10) Line 7606 C++ QtGuid4.dll!QFrame::event(QEvent * e=0x0000000000b67a10) Line 559 + 0xf bytes C++ QtGuid4.dll!QAbstractScrollArea::event(QEvent * e=0x0000000000b67a10) Line 918 + 0x15 bytes C++ QtGuid4.dll!QPlainTextEdit::event(QEvent * e=0x0000000000b67a10) Line 1433 C++ QtGuid4.dll!QApplicationPrivate::notify_helper(QObject * receiver=0x000000001255b2e0, QEvent * e=0x0000000000b67a10) Line 4065 + 0x15 bytes C++ QtGuid4.dll!QApplication::notify(QObject * receiver=0x000000001255b2e0, QEvent * e=0x0000000000b67a10) Line 3664 + 0x1d bytes C++ FreeCADGuiD.dll!Gui::GUIApplication::notify(QObject * receiver=0x000000001255b2e0, QEvent * event=0x0000000000b67a10) Line 1510 + 0x1e bytes C++ QtCored4.dll!QCoreApplication::notifyInternal(QObject * receiver=0x000000001255b2e0, QEvent * event=0x0000000000b67a10) Line 610 + 0x26 bytes C++ QtCored4.dll!QCoreApplication::sendSpontaneousEvent(QObject * receiver=0x000000001255b2e0, QEvent * event=0x0000000000b67a10) Line 216 + 0x4c bytes C++ QtGuid4.dll!QETWidget::sendSpontaneousEvent(QObject * r=0x000000001255b2e0, QEvent * e=0x0000000000b67a10) Line 593 + 0x1e bytes C++ QtGuid4.dll!QKeyMapper::sendKeyEvent(QWidget * widget=0x000000001255b2e0, bool grab=false, QEvent::Type type=KeyPress, int code=16777220, QFlags<enum Qt::KeyboardModifier> * modifiers=0x0000000000b67f08, const QString & text={...}, bool autorepeat=false, int count=0, unsigned int nativeScanCode=28, unsigned int nativeVirtualKey=13, unsigned int nativeModifiers=512, bool * __formal=0x0000000000000000) Line 1253 C++ QtGuid4.dll!QKeyMapperPrivate::translateKeyEvent(QWidget * widget=0x000000001255b2e0, const tagMSG & msg={...}, bool grab=false) Line 1148 + 0x91 bytes C++ QtGuid4.dll!QtWndProc(HWND__ * hwnd=0x00000000002b11b8, unsigned int message=256, unsigned __int64 wParam=13, __int64 lParam=1835009) Line 1776 + 0x58 bytes C++ user32.dll!UserCallWinProcCheckWow() + 0x11d bytes user32.dll!DispatchMessageWorker() + 0x12a bytes QtCored4.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> * flags=0x0000000000b6d3b0) Line 751 + 0x1a bytes C++ QtGuid4.dll!QGuiEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> * flags=0x0000000000b6d3fc) Line 1182 + 0x27 bytes C++ QtCored4.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> * flags=0x0000000000b6d468) Line 150 C++ QtCored4.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> * flags=0x0000000000b6d4f0) Line 201 + 0x53 bytes C++ QtCored4.dll!QCoreApplication::exec() Line 888 + 0x23 bytes C++ QtGuid4.dll!QApplication::exec() Line 3526 C++ FreeCADGuiD.dll!Gui::Application::runApplication() Line 1780 + 0x6 bytes C++ FreeCADD.exe!main(int argc=1, char * * argv=0x0000000004cef0c0) Line 310 C++ FreeCADD.exe!WinMain(HINSTANCE__ * instance=0x000000013f650000, HINSTANCE__ * prevInstance=0x0000000000000000, char * __formal=0x0000000000c455ef, int cmdShow=1) Line 137 + 0x16 bytes C++ FreeCADD.exe!__tmainCRTStartup() Line 574 + 0x42 bytes C FreeCADD.exe!WinMainCRTStartup() Line 399 C |
|
Is there anything i can do, to work around the problem? |
|
Not from your side. But it could be checked if not using StdMeshers_MEFISTO_2D hypothesis still creates a good mesh and if so we can disable for at least Windows. I guess on Linux (in case you use it) you don't have the problem. About the reason what is causing this issue I think it's the way how the Mesfisto lib is built. Maybe it's related to the fact that memory is allocated in the Mefisto lib and freed inside FreeCAD. |
|
shoogen wrote: Thanks for the information, I'm went back to the shape.tessellate function. What makes me suspicous is the fact this problem didn't exitsted two weeks ago. Like Microsoft changed the behavior of my OS. (ollydbg told me that some system DLLs changed) |
|
No, the problem is there for a long time. At the time when the SMESH lib was used as an external library I have seen crashes from time to time. And according to this thread http://www.mail-archive.com/pythonocc-users@gna.org/msg01439.html it even happened with certain Linux OSes. The Python script here https://github.com/tpaviot/pythonocc/blob/master/src/examples/SMESH/surfacic_mesh.py suggests alternatives for the Mefisto mesher but unfortunately it doesn't work for all kind of shapes. If you e.g. create a cylinder it doesn't mesh the lids. Internally the error message says that it cannot mesh faces with only one boundary. |
|
git show fa97cb6c01 uses the Netgen mesher on Windows and the Mefisto mesher on Linux. Using Netgen on all platforms is currently not possible because the latest netgen dev package is not available on most of the Linux distributions. So, this is a workaround for the moment. But note the meshing algorithms work totally differently and uses different parameters. The result is that the created meshes vary in number of triangles. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-10-30 09:11 | shoogen | New Issue | |
2013-10-30 10:20 | shoogen | Note Added: 0003833 | |
2013-10-30 12:05 | shoogen | Note Added: 0003834 | |
2013-10-30 13:42 | wmayer | Note Added: 0003837 | |
2013-10-30 15:02 | shoogen | Note Added: 0003838 | |
2013-10-30 16:23 | wmayer | Note Added: 0003839 | |
2013-10-30 16:33 | shoogen | Note Added: 0003840 | |
2013-10-30 16:34 | shoogen | Note Edited: 0003840 | |
2013-10-30 16:38 | wmayer | Note Added: 0003841 | |
2013-10-30 16:40 | wmayer | Note Added: 0003842 | |
2013-11-03 14:49 | shoogen | Note Added: 0003850 | |
2013-11-05 13:04 | wmayer | Note Added: 0003855 | |
2013-11-05 13:05 | wmayer | Note Added: 0003856 | |
2013-11-05 13:10 | wmayer | Note Added: 0003857 | |
2013-11-05 17:54 | wmayer | Changeset attached | => FreeCAD Master master fa97cb6c |
2013-11-05 17:54 | wmayer | Assigned To | => wmayer |
2013-11-05 17:54 | wmayer | Resolution | open => fixed |
2013-11-05 19:59 | wmayer | Note Added: 0003859 | |
2013-11-05 20:00 | wmayer | Status | new => assigned |
2013-11-05 20:00 | wmayer | Status | assigned => closed |
2013-11-05 20:00 | wmayer | Fixed in Version | => 0.14 |