Black screen - Draft WB

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Black screen - Draft WB

Post by chennes »

Well, the "good" news is that I can reproduce this (on two different machines now). The crash is occurring inside FontConfig when it tries to list out the available substitute fonts for something using "sans" at 50px (or maybe 50pt, I'm not sure). Does that particular font and size sound familiar to any other devs? Does it come from a recent change? (e.g. the last couple of months)(ETA: Nevermind, I reread the thread and found the replacement file). I should note that it's not actually related to the font, if I change the code to use a different one it still crashes, because apparently you always have to search for the font subs even if the font exists. The crash feels a bit intermittent because the call is ultimately driven by a timer in Coin, so it's not necessarily related to a specific user interaction.

It's always possible that the real cause of the crash is memory corruption due to something else entirely, but I will have to switch on guard_malloc (or whatever Visual Studio calls its equivalent) to figure that out for sure. It's easier to start by investigating the current call stack, IMO.

Here's my backtrace:

Code: Select all

 	ntdll.dll!RtlEnterCriticalSection()	Unknown
 	KernelBase.dll!FindNextFileW()	Unknown
 	ucrtbase.dll!common_find_next_wide<_wfinddata64i32_t>()	Unknown
 	ucrtbase.dll!_findnext64i32()	Unknown
 	fontconfig.dll!0000000180014e7f()	Unknown
 	fontconfig.dll!000000018002014c()	Unknown
 	fontconfig.dll!000000018001fe9c()	Unknown
 	fontconfig.dll!000000018001fdaf()	Unknown
 	fontconfig.dll!0000000180017edc()	Unknown
 	fontconfig.dll!00000001800185f3()	Unknown
 	fontconfig.dll!000000018002569d()	Unknown
 	fontconfig.dll!0000000180018ef5()	Unknown
 	fontconfig.dll!000000018001a821()	Unknown
 	Coin4d.dll!cc_fcglue_FcConfigSubstitute(void * config, _FcPattern * pattern, _FcMatchKind kind) Line 266	C++
 	Coin4d.dll!find_font_file(const char * fontname, unsigned int pixelsize) Line 525	C++
 	Coin4d.dll!cc_flwft_get_font(const char * fontname, unsigned int pixelsize) Line 639	C++
>	Coin4d.dll!cc_flw_get_font_id(const char * fontname, unsigned int sizey, float angle, float complexity) Line 561	C++
 	Coin4d.dll!cc_glyph3d_ref(unsigned int character, const cc_font_specification * spec) Line 200	C++
 	Coin4d.dll!SoAsciiTextP::setUpGlyphs(SoState * state, SoAsciiText * textnode) Line 888	C++
 	Coin4d.dll!SoAsciiText::computeBBox(SoAction * action, SbBox3f & box, SbVec3f & center) Line 624	C++
 	Coin4d.dll!SoShape::getBBox(SoAction * action, SbBox3f & box, SbVec3f & center) Line 1493	C++
 	Coin4d.dll!SoShape::getBoundingBox(SoGetBoundingBoxAction * action) Line 392	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoGroup::getBoundingBox(SoGetBoundingBoxAction * action) Line 582	C++
 	Coin4d.dll!SoSeparator::getBoundingBox(SoGetBoundingBoxAction * action) Line 576	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoGroup::getBoundingBox(SoGetBoundingBoxAction * action) Line 582	C++
 	Coin4d.dll!SoSeparator::getBoundingBox(SoGetBoundingBoxAction * action) Line 576	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoGroup::getBoundingBox(SoGetBoundingBoxAction * action) Line 582	C++
 	Coin4d.dll!SoSeparator::getBoundingBox(SoGetBoundingBoxAction * action) Line 576	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoGroup::getBoundingBox(SoGetBoundingBoxAction * action) Line 582	C++
 	Coin4d.dll!SoSeparator::getBoundingBox(SoGetBoundingBoxAction * action) Line 576	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoSwitch::doAction(SoAction * action) Line 322	C++
 	Coin4d.dll!SoSwitch::getBoundingBox(SoGetBoundingBoxAction * action) Line 226	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoGroup::getBoundingBox(SoGetBoundingBoxAction * action) Line 582	C++
 	Coin4d.dll!SoSeparator::getBoundingBox(SoGetBoundingBoxAction * action) Line 576	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int first, const int last) Line 381	C++
 	Coin4d.dll!SoChildList::traverse(SoAction * const action, const int index) Line 462	C++
 	Coin4d.dll!SoGroup::getBoundingBox(SoGetBoundingBoxAction * action) Line 582	C++
 	Coin4d.dll!SoSeparator::getBoundingBox(SoGetBoundingBoxAction * action) Line 576	C++
 	Coin4d.dll!SoNode::getBoundingBoxS(SoAction * action, SoNode * node) Line 893	C++
 	Coin4d.dll!SoAction::traverse(SoNode * const node) Line 951	C++
 	Coin4d.dll!SoAction::beginTraversal(SoNode * node) Line 1273	C++
 	Coin4d.dll!SoGetBoundingBoxAction::beginTraversal(SoNode * node) Line 603	C++
 	Coin4d.dll!SoAction::apply(SoNode * root) Line 566	C++
 	Coin4d.dll!SoRenderManagerP::setClippingPlanes() Line 120	C++
 	Coin4d.dll!SoRenderManagerP::updateClippingPlanesCB(void * closure, SoSensor * sensor) Line 102	C++
 	Coin4d.dll!SoSensor::trigger() Line 199	C++
 	Coin4d.dll!SoDelayQueueSensor::trigger() Line 163	C++
 	Coin4d.dll!SoDataSensor::trigger() Line 289	C++
 	Coin4d.dll!SoSensorManager::processDelayQueue(int isidle) Line 609	C++
 	Coin4d.dll!timeoutsensor_cb(void * userdata, SoSensor * __formal) Line 247	C++
 	Coin4d.dll!SoSensor::trigger() Line 199	C++
 	Coin4d.dll!SoTimerQueueSensor::trigger() Line 177	C++
 	Coin4d.dll!SoSensorManager::processTimerQueue() Line 493	C++
 	FreeCADGui_d.dll!SIM::Coin3D::Quarter::SensorManager::idleTimeout() Line 150	C++
 	FreeCADGui_d.dll!SIM::Coin3D::Quarter::SensorManager::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 88	C++
 	[External Code]	
 	FreeCADGui_d.dll!Gui::GUIApplication::notify(QObject * receiver, QEvent * event) Line 92	C++
 	[External Code]	
 	FreeCADGui_d.dll!Gui::GUIApplication::notify(QObject * receiver, QEvent * event) Line 92	C++
 	[External Code]	
 	FreeCADGui_d.dll!Gui::Application::runApplication() Line 2287	C++
 	FreeCAD_d.exe!main(int argc, char * * argv) Line 302	C++
 	FreeCAD_d.exe!WinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, char * __formal, int __formal) Line 97	C++
 	[External Code]	
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Black screen - Draft WB

Post by chennes »

And an update: doing the replacement of guitrackers.py as suggested by @carlopav in this post does resolve the issue, and I don't experience any further crashes in Draft. Is it worth continuing the investigation into the underlying cause of the problem, or do you ("you" being those of you who are actually working on Draft) know what's going on here and I should leave it alone?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Black screen - Draft WB

Post by chennes »

I actually get the exact same crash if I am using the BSpline tool in Sketcher, when I try to close a spline around on itself. So it's not really just Draft, but I have no idea what these various pieces of code have in common. Maybe @abdullah can shed some light on it?
abdullah wrote: Ping
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Black screen - Draft WB

Post by abdullah »

chennes wrote: Tue Jan 26, 2021 3:45 pm I actually get the exact same crash if I am using the BSpline tool in Sketcher, when I try to close a spline around on itself. So it's not really just Draft, but I have no idea what these various pieces of code have in common. Maybe @abdullah can shed some light on it?
abdullah wrote: Ping
The only "common link" between Draft and Sketcher is Part:Part2DObject. It is daddy for SketchObject. Not sure exactly how it goes with Draft objects. Then, the view provider "ViewProvider2DObject", Draft using the Python version and ViewProviderSketch inheriting from ViewProvider2DObjectGrid, which inherits from "ViewProvider2DObject".

Although correlation indicates the two crashes are related, maybe they are not. Maybe they are caused by separate independent issues.

I can close a bpsline with endpoint coincident with startpoint (via autoconstraints) without issue... :(
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Black screen - Draft WB

Post by chennes »

abdullah wrote: Tue Jan 26, 2021 4:06 pm Although correlation indicates the two crashes are related, maybe they are not. Maybe they are caused by separate independent issues.
Well, they are related in the sense that they have the exact same backtrace: so the crash is literally in the same spot. Something screwy is going on with Coin.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Black screen - Draft WB

Post by abdullah »

chennes wrote: Tue Jan 26, 2021 4:33 pm
abdullah wrote: Tue Jan 26, 2021 4:06 pm Although correlation indicates the two crashes are related, maybe they are not. Maybe they are caused by separate independent issues.
Well, they are related in the sense that they have the exact same backtrace: so the crash is literally in the same spot. Something screwy is going on with Coin.
Ok. Sorry. Missed that point.
marioalexis
Posts: 124
Joined: Wed Jun 19, 2019 7:44 pm

Re: Black screen - Draft WB

Post by marioalexis »

Some days ago a series of crash in draft was resolved. Coin related, but not a Coin or Pivy issue.
@chennes all the reports of the problem discussed here were made by Windows users. I am on Linux, but taking advantage of carlopav's suggestion I can try to see if there is something strange in that sector of the code. If I find something, can I send it to you for testing?
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Black screen - Draft WB

Post by chennes »

marioalexis wrote: Tue Jan 26, 2021 5:00 pm If I find something, can I send it to you for testing?
Yes, I'd be happy to test it.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Black screen - Draft WB

Post by carlopav »

Many thanks guys for stepping in :)
follow my experiments on BIM modelling for architecture design
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Black screen - Draft WB

Post by chennes »

OK, I have an actual solution for this now. The problem seems to be a bad version of fontconfig included with the current Windows installer of GraphViz. I don't know the internal details of what is wrong with it, but simply creating a new fontconfig.dll and replacing the one that is shipped with GraphViz resolved this problem, and did not affect GraphViz's functionality as far as I can tell (that is, it still creates dependency graphs in FC just fine).

Quick overview:
1) Get vcpkg (if you don't already have it) -- follow its normal installation process.
2) Run vcpgk.exe install fontconfig
3) Copy VCPKGROOT/packages/fontconfig_x86-windows/bin/fontconfig-1.dll over the top of C:\Program Files\Graphviz 2.44.1\bin
fontconfig.dll (or wherever your GraphViz is installed).

I've also attached a zip of my DLL to this post if you feel like trusting a random DLL you downloaded off the internet.
Attachments
fontconfig.zip
(109.74 KiB) Downloaded 63 times
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply