Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2310

Reg->6.4.3: Crashing without error reporting in Qt-based threads starting from PySide6 v6.4.3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.5.1, 6.6.0
    • 6.5.0, 6.4.3
    • PySide
    • None
    • All
    • 6a92d8450 (dev), 2368bbdfd (6.5), 91d0d3f1e (dev), 5fb531118 (6.5), baedbe835 (dev), 28ddc0e50 (6.5)

    Description

      Steps to reproduce

       pip install openai
      
      • Run pyside2310.py
      • Enter text, press <Enter>
      • Actual: crash after a while
      • Expected: Exeption openai.error.AuthenticationError is immediately reported on stderr

      I got it this problem with all my projects that uses QThreadPool and QRunnable objects, when an exception raises inside a QRunnable, the app stops responding for a while and then it crashes with no error trackback, and I just get "Process finished with exit code -1073741819 (0xC0000005)".

      And this happens even in a normal terminal without an IDE, and it turns out that this problem totally goes away when I downgraded to PySide6 v6.4.2, I included a sample that suffers from this problem, open it and write anything in the box and hit enter.

      Inside "ChatGPTGUI" class, in "eventFilter" function and  in "thread" function, the line:-

      completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=self.chatgpt_buffer)

      Will raise an exception because the API key is wrong, in PySide6 v6.4.3 or higher, the app will crash as I mentioned, but in version PySide6 v6.4.2, it will report the exception normally in the terminal without crashing.

      Also I noticed a big speed boost all functions that was called with QRunnables when I downgraded to PySide6 v6.4.2 in my projects, this issue is critical and it's not easy to notice unless someone was missing with old versions, specially the speed problem, I noticed it by luck.

      In the file I included, the problem is visible here but it can be caught if the app got launched in a debugger, I have other more extreme cause where even the debugger can't catch the errors, but it a very big project and I can't imagine how I will minimize it yet, but I wish this sample I uploaded is sufficient to track down the problem.

      Attachments

        1. pyside2310_stack.txt
          58 kB
        2. pyside2310_valgrind.txt
          3 kB
        3. pyside2310.py
          3 kB

        Issue Links

          For Gerrit Dashboard: PYSIDE-2310
          # Subject Branch Project Status CR V

          Activity

            People

              ctismer Christian Tismer
              ahmedahmedeg Ahmed Ahmed Abd Al Maksoud
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: