olivierkes / manuskript

A open-source tool for writers
http://www.theologeek.ch/manuskript
GNU General Public License v3.0
1.74k stars 229 forks source link

Seg fault after upgrading to KDE Plasma 5.24.0 (Qt 5.13.3) #1011

Open bame55 opened 2 years ago

bame55 commented 2 years ago

As it says in the title, I just upgraded to KDE Plasma 5.24.0 (Qt 5.13.3) and now Manuskript seg faults. It starts normally, lets me open a project, but dies within seconds (1-20 usually) after I start working on the project.

I tried reinstalling the latest official version (0.13.1) but that didn't fix the problem. I also tried reverting to 0.12.0. Same problem. I also tried the github/dev version which appears to be 0.13.1. Same problem.

Log from the github version is below. Nearly identical to logs from other versions.

2022-02-11 14:30:02,391 DEBUG:Logging to STDERR. 2022-02-11 14:30:02,481 INFO:Logging to file: /home/bbame/.local/share/manuskript/manuskript/logs/2022-02-11_14-30-02_manuskript#172902.log 2022-02-11 14:30:02,490 INFO:Operating System: Linux-5.13.0-28-generic-x86_64-with-glibc2.29 2022-02-11 14:30:02,490 INFO:Hardware: x86_64 / x86_64 2022-02-11 14:30:02,490 INFO:Running from unpackaged source code. 2022-02-11 14:30:02,490 DEBUG: sys.executable = '/usr/bin/python3' 2022-02-11 14:30:02,491 DEBUG: sys.argv = ['./manuskript'] 2022-02-11 14:30:02,491 DEBUG: sys.path = ['/media/extra01/home/bbame/src/manuskript/bin', '/media/extra01/home/bbame/src/manuskript/bin/..', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/bbame/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'] 2022-02-11 14:30:02,491 DEBUG: sys.prefix = '/usr' 2022-02-11 14:30:02,493 INFO:Manuskript 0.13.1#9e8e7a2 (Python 3.8.10) 2022-02-11 14:30:02,493 INFO: PyQt 5.15.4 (compiled against Qt 5.15.3) 2022-02-11 14:30:02,493 INFO: Qt 5.15.3 (runtime) 2022-02-11 14:30:02,499 INFO: lxml.etree 4.7.1.0 2022-02-11 14:30:02,499 INFO: libxml 2.9.12 (compiled: 2.9.12) 2022-02-11 14:30:02,499 INFO: libxslt 1.1.34 (compiled: 1.1.34) 2022-02-11 14:30:02,499 INFO: pyEnchant 3.2.2 (libenchant: 2.2.8) 2022-02-11 14:30:02,500 INFO: pySpellChecker 0.6.3 2022-02-11 14:30:02,500 INFO: Symspellpy 6.7.6 2022-02-11 14:30:02,526 INFO: Markdown 3.3.6 2022-02-11 14:30:02,526 INFO:Web rendering engine: QTextEdit 2022-02-11 14:30:02,539 INFO:Preferred translation: ['en-US'] (based on available ui languages) 2022-02-11 14:30:02,539 INFO:Using the builtin translation. (U.S. English) 2022-02-11 14:30:06,596 INFO:Loading: /home/bbame/Desktop/test.msk 2022-02-11 14:30:06,596 INFO:Detected file format version: 1. Zip: True. 2022-02-11 14:30:06,596 DEBUG:Loading /home/bbame/Desktop/test.msk (zip) 2022-02-11 14:30:06,597 DEBUG:Reading labels: 2022-02-11 14:30:06,597 DEBUG: Add status: Idea (#ffff00) 2022-02-11 14:30:06,597 DEBUG: Add status: Note (#00ff00) 2022-02-11 14:30:06,597 DEBUG: Add status: Chapter (#0000ff) 2022-02-11 14:30:06,597 DEBUG: Add status: Scene (#ff0000) 2022-02-11 14:30:06,597 DEBUG: Add status: Research (#00ffff) 2022-02-11 14:30:06,597 DEBUG:Reading status: 2022-02-11 14:30:06,597 DEBUG: Add status: TODO 2022-02-11 14:30:06,597 DEBUG: Add status: First draft 2022-02-11 14:30:06,598 DEBUG: Add status: Second draft 2022-02-11 14:30:06,598 DEBUG: Add status: Final 2022-02-11 14:30:06,598 DEBUG:Reading plots: 2022-02-11 14:30:06,598 DEBUG:Reading World: 2022-02-11 14:30:06,598 DEBUG:Reading Characters: 2022-02-11 14:30:06,598 DEBUG:Reading outline: 2022-02-11 14:30:06,598 DEBUG:* Adds 0-Chapter_1.md to Root (file) 2022-02-11 14:30:06,599 INFO:Project /home/bbame/Desktop/test.msk loaded. 2022-02-11 14:30:19,075 INFO:Saving to: zip 2022-02-11 14:30:19,078 INFO:Project test.msk saved. Fatal Python error: Segmentation fault

Current thread 0x00007f066f79c740 (most recent call first): File "/media/extra01/home/bbame/src/manuskript/bin/../manuskript/main.py", line 243 in launch File "/media/extra01/home/bbame/src/manuskript/bin/../manuskript/main.py", line 309 in run File "./manuskript", line 13 in Segmentation fault

SergSel2006 commented 2 years ago

I have the same issue too. And logs are the same. I want to know what is your Linux distribution and have you tired to do make debug, because I do this, but it didn't output anything useful. Wanted to know if it's related to specific distribution

bame55 commented 2 years ago

I'm using Neon 5.24, which is a KDE-centric spin of Ubuntu 20.04. make debug wasn't helpful for me either. To me it appears the seg fault happens somewhere inside Qt rather than in the Manuskript's python code, so potentially this is a bug in either Qt 5.13.3 or PyQt.

SergSel2006 commented 2 years ago

yeah, it looks like Qt specific bug (or just some very bad code usage), and it is not distribution-specific, because I use Manjaro (which is basically arch), so we need to look at Qt's forum.

matthewadie commented 2 years ago

I'm running Plasma 5.24.3 with Qt 5.15.3 and Manuskript keeps crashing on me as well. It happens with the Arch version of 0.13.1 as well as with the source code version of 0.13.1 downloaded from github.

Here's the output of running it from the command line:

$ manuskript Fatal Python error: Segmentation fault

Current thread 0x00007f921f1c7740 (most recent call first): File "/usr/share/manuskript/manuskript/main.py", line 243 in launch File "/usr/share/manuskript/manuskript/main.py", line 309 in run File "/usr/bin/manuskript", line 30 in

Extension modules: PyQt5.QtCore, PyQt5.QtGui, PyQt5.QtWidgets, PyQt5.QtNetwork, PyQt5.QtQml, PyQt5.QtDBus, PyQt5.QtMultimedia, PyQt5.QtMultimediaWidgets, PyQt5.QtOpenGL, PyQt5.QtPositioning, PyQt5.QtLocation, PyQt5.QtPrintSupport, PyQt5.QtQuick, PyQt5.QtQuickWidgets, PyQt5.QtSensors, PyQt5.QtSql, PyQt5.QtSvg, PyQt5.QtTest, PyQt5.QtTextToSpeech, PyQt5.QtWebChannel, PyQt5.QtWebSockets, PyQt5.QtX11Extras, PyQt5.QtXml, lxml._elementpath, lxml.etree (total: 25) Segmentation fault (core dumped)

--

These are my system details:

Operating System: Arch Linux KDE Plasma Version: 5.24.3 KDE Frameworks Version: 5.91.0 Qt Version: 5.15.3 Kernel Version: 5.16.14-arch1-1 (64-bit) Graphics Platform: Wayland Processors: 12 × AMD Ryzen 5 5600U with Radeon Graphics Memory: 15.0 GiB of RAM Graphics Processor: AMD RENOIR

--

This is the log Manuskript Log -- no mention of a crash in it though:

2022-03-12 13:00:03,132 - manuskript.logging - INFO - Logging to file: /home/m80/.local/share/manuskript/manuskript/logs/2022-03-12_13-00-03_manuskript#41855.log 2022-03-12 13:00:03,133 - manuskript - INFO - Operating System: Linux-5.16.14-arch1-1-x86_64-with-glibc2.35 2022-03-12 13:00:03,133 - manuskript - INFO - Hardware: x86_64 / 2022-03-12 13:00:03,133 - manuskript - INFO - Running from unpackaged source code. 2022-03-12 13:00:03,133 - manuskript - DEBUG - sys.executable = '/usr/bin/python3' 2022-03-12 13:00:03,133 - manuskript - DEBUG - sys.argv = ['/usr/bin/manuskript'] 2022-03-12 13:00:03,133 - manuskript - DEBUG - sys.path = ['/usr/bin', '/usr/share/manuskript/', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages'] 2022-03-12 13:00:03,133 - manuskript - DEBUG - sys.prefix = '/usr' 2022-03-12 13:00:03,134 - manuskript - INFO - Manuskript 0.13.1 (Python 3.10.2) 2022-03-12 13:00:03,134 - manuskript - INFO - PyQt 5.15.6 (compiled against Qt 5.15.2) 2022-03-12 13:00:03,134 - manuskript - INFO - Qt 5.15.3 (runtime) 2022-03-12 13:00:03,138 - manuskript - INFO - lxml.etree 4.7.1.0 2022-03-12 13:00:03,138 - manuskript - INFO - libxml 2.9.13 (compiled: 2.9.12) 2022-03-12 13:00:03,138 - manuskript - INFO - libxslt 1.1.35 (compiled: 1.1.34) 2022-03-12 13:00:03,138 - manuskript - INFO - pyEnchant 3.2.2 (libenchant: 2.3.2) 2022-03-12 13:00:03,138 - manuskript - INFO - pySpellChecker N/A 2022-03-12 13:00:03,138 - manuskript - INFO - Symspellpy N/A 2022-03-12 13:00:03,161 - manuskript - INFO - Markdown 3.3.6 2022-03-12 13:00:03,161 - manuskript - INFO - Web rendering engine: QTextEdit 2022-03-12 13:00:03,173 - manuskript.main - INFO - Preferred translation: ['en-US'] (based on available ui languages) 2022-03-12 13:00:03,173 - manuskript.main - INFO - Using the builtin translation. (U.S. English) 2022-03-12 13:00:03,444 - manuskript.loadSave - INFO - Loading: /home/m80/Documents/test2.msk 2022-03-12 13:00:03,444 - manuskript.loadSave - INFO - Detected file format version: 1. Zip: True. 2022-03-12 13:00:03,444 - manuskript.load_save.version_1 - DEBUG - Loading /home/m80/Documents/test2.msk (zip) 2022-03-12 13:00:03,444 - manuskript.load_save.version_1 - DEBUG - Reading labels: 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Idea (#ffff00) 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Note (#00ff00) 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Chapter (#0000ff) 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Scene (#ff0000) 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Research (#00ffff) 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Reading status: 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: TODO 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: First draft 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Second draft 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Add status: Final 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Reading plots: 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Reading World: 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Reading Characters: 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Reading outline: 2022-03-12 13:00:03,445 - manuskript.load_save.version_1 - DEBUG - Adds 00-Scene_1.md to Root (file) 2022-03-12 13:00:03,446 - manuskript.load_save.version_1 - DEBUG - Adds 01-Scene_2.md to Root (file) 2022-03-12 13:00:03,446 - manuskript.load_save.version_1 - DEBUG - Adds 02-Scene_3.md to Root (file) 2022-03-12 13:00:03,446 - manuskript.load_save.version_1 - DEBUG - Adds 03-Scene_4.md to Root (file) 2022-03-12 13:00:03,446 - manuskript.load_save.version_1 - DEBUG - Adds 04-Scene_5.md to Root (file) 2022-03-12 13:00:03,447 - manuskript.load_save.version_1 - DEBUG - Adds 05-Scene_6.md to Root (file) 2022-03-12 13:00:03,447 - manuskript.load_save.version_1 - DEBUG - Adds 06-Scene_7.md to Root (file) 2022-03-12 13:00:03,447 - manuskript.load_save.version_1 - DEBUG - Adds 07-Scene_8.md to Root (file) 2022-03-12 13:00:03,447 - manuskript.load_save.version_1 - DEBUG - Adds 08-Scene_9.md to Root (file) 2022-03-12 13:00:03,448 - manuskript.load_save.version_1 - DEBUG - Adds 09-Scene_10.md to Root (file) 2022-03-12 13:00:03,448 - manuskript.mainWindow - INFO - Project /home/m80/Documents/test2.msk loaded.

Matthew

TheJackiMonster commented 2 years ago

Do you use any Qt themes which could cause this?

matthewadie commented 2 years ago

Yes, it seems that if I leave it on the "Fusion" theme everything is Ok, but when I switch to the "Breeze" theme it starts crashing.

TheJackiMonster commented 2 years ago

Good, I flagged this as another Qt themes related bug then. This will probably not be solvable on side of Manuskript. I recommend using the default themes from Qt itself then.

adocampo commented 2 years ago

I'm having the same issue after creating or opening an old msk file on Sistema operativo: Arch Linux Versión de KDE Plasma: 5.24.4 Versión de KDE Frameworks: 5.93.0 Versión de Qt: 5.15.3 Versión del kernel: 5.17.5-arch1-1 (64 bits) Plataforma gráfica: X11 Procesadores: 16 × 11th Gen Intel® Core™ i7-11700K @ 3.60GHz Memoria: 46,9 GiB de RAM Procesador gráfico: NVIDIA GeForce RTX 3070 Ti/PCIe/SSE2

CRITICAL> An unhandled exception has occurred!
Traceback (most recent call last):
  File "/usr/share/manuskript/manuskript/logging.py", line 221, in qtMessageHandler
    log_level = [logging.DEBUG,
IndexError: list index out of range
double free or corruption (out)
Fatal Python error: Aborted

Current thread 0x00007f5abacc6b80 (most recent call first):
  File "/usr/share/manuskript/manuskript/ui/welcome.py", line 196 in createFile
  File "/usr/share/manuskript/manuskript/main.py", line 243 in launch
  File "/usr/share/manuskript/manuskript/main.py", line 309 in run
  File "/usr/bin/manuskript", line 30 in <module>

Extension modules: PyQt5.QtCore, PyQt5.QtGui, PyQt5.QtWidgets, PyQt5.QtNetwork, PyQt5.QtQml, PyQt5.QtDBus, PyQt5.QtDesigner, PyQt5.QtHelp, PyQt5.QtMultimedia, PyQt5.QtMultimediaWidgets, PyQt5.QtOpenGL, PyQt5.QtPositioning, PyQt5.QtLocation, PyQt5.QtPrintSupport, PyQt5.QtQuick, PyQt5.QtQuick3D, PyQt5.QtQuickWidgets, PyQt5.QtSensors, PyQt5.QtSerialPort, PyQt5.QtSql, PyQt5.QtSvg, PyQt5.QtTest, PyQt5.QtTextToSpeech, PyQt5.QtWebChannel, PyQt5.QtWebKit, PyQt5.QtWebKitWidgets, PyQt5.QtWebSockets, PyQt5.QtX11Extras, PyQt5.QtXml, PyQt5.QtXmlPatterns, lxml._elementpath, lxml.etree (total: 32)
zsh: IOT instruction (core dumped)  manuskript

So, what are the default Qt themes I should try in order to avoid crashing? I'm using breeze dark theme, but I've tried several and manuskript fails with all of them

adocampo commented 2 years ago

just to make a test, I went to line 221 of /usr/share/manuskript/manuskript/logging.py which was the line the traceback pointed, and modified the code and put the code inside a try catch block, to see if that did the trick, and it did

def qtMessageHandler(msg_type, msg_log_context, msg_string):
    """Forwards Qt messages to Python logging system."""
    # Convert Qt msg type to logging level
    try:
        log_level = [logging.DEBUG,
                    logging.WARNING,
                    logging.ERROR,
                    logging.FATAL] [ int(msg_type) ]
        qtcl = logging.getLogger(msg_log_context.category or "qt.???")

    # Some information may not be available unless using a PyQt debug build.
    # See: https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtcore/qmessagelogcontext.html
        if QLibraryInfo.isDebugBuild():
            qtcl.log(logging.DEBUG,
                        ' @ {0} : {1}'.format((msg_log_context.file or "<unknown source file>"), msg_log_context.line)
                        )
            qtcl.log(logging.DEBUG,
                        ' ! {0}'.format((msg_log_context.function or "<unknown function>"))
                        )
        qtcl.log(log_level, msg_string)
    except:
        pass

Obviously, a try-except-pass is a complete error, but now manuskript starts and seems to work, perhaps the developers can have a hint now to solve the issue.

EDITED: after a quick review of the application, it seems to work mostly. I just found it crashes when I click on a chapter name, but not on the expand arrow imagen with this exception

RITICAL> An unhandled exception has occurred!
Traceback (most recent call last):
  File "/usr/share/manuskript/manuskript/ui/editors/mainEditor.py", line 200, in selectionChanged
    self.setCurrentModelIndex(idx)
  File "/usr/share/manuskript/manuskript/ui/editors/mainEditor.py", line 236, in setCurrentModelIndex
    self.currentEditor(tabWidget).setCurrentModelIndex(index)
  File "/usr/share/manuskript/manuskript/ui/editors/editorWidget.py", line 312, in setCurrentModelIndex
    self.setView()
  File "/usr/share/manuskript/manuskript/ui/editors/editorWidget.py", line 256, in setView
    addTitle(item)
  File "/usr/share/manuskript/manuskript/ui/editors/editorWidget.py", line 181, in addTitle
    edt = MDEditView(self, html="<h{l}>{t}</h{l}>".format(l=min(itm.level() + 1, 5), t=itm.title()),
  File "/usr/share/manuskript/manuskript/ui/views/MDEditView.py", line 30, in __init__
    textEditView.__init__(self, parent, index, html, spellcheck,
  File "/usr/share/manuskript/manuskript/ui/views/textEditView.py", line 53, in __init__
    self.setAutoResize(autoResize)
  File "/usr/share/manuskript/manuskript/ui/views/textEditView.py", line 380, in setAutoResize
    self.sizeChange()
  File "/usr/share/manuskript/manuskript/ui/views/textEditView.py", line 372, in sizeChange
    self.setMinimumHeight(docHeight)
TypeError: setMinimumHeight(self, int): argument 1 has unexpected type 'float'

But I guess this is not related to this issue.

TheJackiMonster commented 2 years ago

just to make a test, I went to line 221 of /usr/share/manuskript/manuskript/logging.py which was the line the traceback pointed, and modified the code and put the code inside a try catch block, to see if that did the trick, and it did

Today I added a proper fix for that upstream. So the next version shouldn't cause a segfault anymore on conversion problems with the logging level.

TypeError: setMinimumHeight(self, int): argument 1 has unexpected type 'float'

I would think this is some Python issue which appeared when using a newer version (older versions had implicit type conversion on float values to int parameters if required but that changed). I will fix that.

TheJackiMonster commented 2 years ago

Nevermind, it seems that the problem with line 372 in manuskript/ui/views/textEditView.py is already fixed in the repository. I recommend trying the version in the develop branch and see if the issue still occurs (it shouldn't).

adocampo commented 2 years ago

Nevermind, it seems that the problem with line 372 in manuskript/ui/views/textEditView.py is already fixed in the repository. I recommend trying the version in the develop branch and see if the issue still occurs (it shouldn't).

That was fast! Yeah, it works just fine here. Thank you!

I will wait for the unexpected type 'float' issue to be fixed on the release to have it managed by my package manager, though, to have it properly installed.

cristianmtr commented 2 years ago

I also just got the unexpected type 'float' error.

Ubuntu 22.04, python 3.10 as system python. Installed with apt.