Draft workbench bezier crash - Too many open files - Linux

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Chip Biffington
Posts: 6
Joined: Sun Oct 30, 2022 1:30 am

Draft workbench bezier crash - Too many open files - Linux

Post by Chip Biffington »

Update:

This issue is caused by starting freecad.AppImage with nohup.

Error occurs when started like this:

Code: Select all

$ nohup freecad.AppImage >freecad.log &
I've learned nohup isn't actually needed because:

Code: Select all

$ shopt  | grep  huponexit
huponexit off
Current working command:

Code: Select all

stdbuf -oL -eL freecad.AppImage &>freecad.log &
Without stdbuf, stdout/stderr are written to freecad.log on exit instead of during execution.

I apologize if this has become off topic. I will happily remove if requested.

Original post:

Code: Select all

OS: Manjaro Linux (i3/i3)
Word size of FreeCAD: 64-bit
Version: 0.21.30747 (Git) AppImage
Build type: Release
Branch: master
Hash: 4e643dcec3ed5ee882fc7b31710d9bfe3d331ffe
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
FreeCAD_weekly-builds-30747-2022-10-27-conda-Linux-x86_64-py310.AppImage

Steps:
  • Start FreeCAD
  • Select Draft Workbench
  • Select Bezier Curve
  • Click to create 3 points
  • Press "A" to finish
This results in the following error.

Code: Select all

00:00:28  Traceback (most recent call last):
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftutils/todo.py", line 167, in doTasks
  File "<string>", line 1, in <module>
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftmake/make_bezcurve.py", line 100, in make_bezcurve
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftviewproviders/view_bezcurve.py", line 40, in __init__
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftviewproviders/view_wire.py", line 56, in __init__
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftviewproviders/view_base.py", line 95, in __init__
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftviewproviders/view_wire.py", line 61, in _set_properties
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftviewproviders/view_base.py", line 107, in _set_properties
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftutils/utils.py", line 786, in svg_patterns
  File "/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/draftutils/utils.py", line 727, in load_svg_patterns
  File "/tmp/.mount_FreeCAcO2RLx/usr/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1016, in get_code
  File "<frozen importlib._bootstrap_external>", line 1073, in get_data
OSError: [Errno 24] Too many open files: '/tmp/.mount_FreeCAcO2RLx/usr/Mod/Draft/importSVG.py'

00:00:28  ToDo.doTasks, Unexpected error:
<class 'OSError'>
in ['points = [FreeCAD.Vector(-21.085184756422862, -23.290278757836106, -13.749368447054492), FreeCAD.Vector(-32.71330584608553, -3.386146666367429, 19.171628238075712), FreeCAD.Vector(10.178518219812101, 21.377398808713966, 19.17164009848673)]', 'bez = Draft.make_bezcurve(points, closed=False, support=None, degree=None)', 'Draft.autogroup(bez)', 'FreeCAD.ActiveDocument.recompute()']
lsof shows /dev/null has been opened by the FreeCAD process about 1000 times.

I cannot find any relevant information via searching.

I am not sure how to troubleshoot further.

Thank you.
User avatar
thomas-neemann
Veteran
Posts: 11921
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Draft workbench bezier crash - Too many open files - Linux

Post by thomas-neemann »

Chip Biffington wrote: Sun Oct 30, 2022 4:50 am ...


I can not confirm the error. here it works

Code: Select all

OS: Ubuntu 20.04.1 LTS (XFCE/xubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.30747 (Git) AppImage
Build type: Release
Branch: master
Hash: 4e643dcec3ed5ee882fc7b31710d9bfe3d331ffe
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: German/Germany (de_DE)
Installed mods: 
  * Curves 0.5.12
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
Chip Biffington
Posts: 6
Joined: Sun Oct 30, 2022 1:30 am

Re: Draft workbench bezier crash - Too many open files - Linux

Post by Chip Biffington »

thomas-neemann wrote: Tue Nov 01, 2022 9:04 pm I can not confirm the error. here it works
Just to confirm, you're using the following command, yes?

Code: Select all

$ nohup freecad.AppImage >freecad.log &
User avatar
thomas-neemann
Veteran
Posts: 11921
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Draft workbench bezier crash - Too many open files - Linux

Post by thomas-neemann »

Chip Biffington wrote: Thu Nov 03, 2022 5:47 am ...
No I have not. what is it needed for?
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
Chip Biffington
Posts: 6
Joined: Sun Oct 30, 2022 1:30 am

Re: Draft workbench bezier crash - Too many open files - Linux

Post by Chip Biffington »

thomas-neemann wrote: Thu Nov 03, 2022 7:02 am what is it needed for?
nohup is a linux program that prevents the transmission of SIGHUP.

SIGHUP is the hangup signal which generally causes a process to exit.

Terminal programs often send SIGHUP to running jobs when closed.

For example, let's say I start freecad.AppImage from a terminal then exit the terminal like this:

Code: Select all

$ ./freecad.AppImage &
$ exit
If the terminal is set to send SIGHUP on exit, which is often the case, then the freecad process will be killed.

To prevent this behavior, nohup is used like this:

Code: Select all

$ nohup freecad.AppImage &
Now if I exit the terminal the freecad process will continue to run.

Sometimes, you want to redirect stdout and stderr when using nohup so you end up with this:

Code: Select all

$ nohup freecad.AppImage &>/freecad.log &
This redirects stderr to stdout then redirects stdout to the freecad.log file. You might have to deal with buffering here which I will leave as an exercise for the reader.

My original error seems to be caused by using nohup with redirect. It doesn't really matter at this point because my terminal is set to not send SIGHUP on exit.

So the issue is kind of solved and kind of off topic now, but I've left it up in case someone else runs into this issue.
User avatar
thomas-neemann
Veteran
Posts: 11921
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Draft workbench bezier crash - Too many open files - Linux

Post by thomas-neemann »

Chip Biffington wrote: Fri Nov 04, 2022 8:22 pm ...
ok, but why do you want to close the terminal window?
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
Chip Biffington
Posts: 6
Joined: Sun Oct 30, 2022 1:30 am

Re: Draft workbench bezier crash - Too many open files - Linux

Post by Chip Biffington »

thomas-neemann wrote: Fri Nov 04, 2022 8:39 pm ok, but why do you want to close the terminal window?
The terminal serves no purpose after starting freecad.AppImage.
User avatar
thomas-neemann
Veteran
Posts: 11921
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Draft workbench bezier crash - Too many open files - Linux

Post by thomas-neemann »

Chip Biffington wrote: Fri Nov 04, 2022 8:47 pm ...
this seems to be a cosmetic problem :-)
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
Chip Biffington
Posts: 6
Joined: Sun Oct 30, 2022 1:30 am

Re: Draft workbench bezier crash - Too many open files - Linux

Post by Chip Biffington »

thomas-neemann wrote: Fri Nov 04, 2022 8:50 pm this seems to be a cosmetic problem :-)
Sorry, is this a joke? I don't understand.
User avatar
thomas-neemann
Veteran
Posts: 11921
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: Draft workbench bezier crash - Too many open files - Linux

Post by thomas-neemann »

Chip Biffington wrote: Fri Nov 04, 2022 9:02 pm ...
in my opinion there are important problems in freecad (tnp, techdraw, sketcher etc). I don't think this is an urgent problem, but it seems to have already been solved.
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
Post Reply