Opened 4 years ago

Closed 4 years ago

#5344 closed defect (fixed)

Logger: RuntimeError: wrapped C/C++ object of type QTimer has been deleted

Reported by: guillaume.gaullier@… Owned by: Tom Goddard
Priority: moderate Milestone:
Component: Logging Version:
Keywords: Cc: pett
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description (last modified by Tom Goddard)

Begin forwarded message:

From: Guillaume Gaullier via ChimeraX-users <chimerax-users@…>
Subject: [chimerax-users] Error messages when executing command file with chimerax --exit
Date: October 5, 2021 at 2:01:02 AM PDT
To: ChimeraX Users Help <chimerax-users@…>
Reply-To: Guillaume Gaullier

Hello,

When I run the attached command file from within ChimeraX 1.2.5 on macOS 10.15.7 (open 7otq_figure-2-supplement-2.cxc), it completes without any error. However, when I run it from the shell with 'chimerax --exit 7otq_figure-2-supplement-2.cxc', I get the attached errors in the terminal. In both cases, the figures are generated correctly, so as far as I am concerned it seems I can simply ignore these errors. But I thought you (ChimeraX developers) might need to know that this happens.

This does not happen with other command files (I have been happily making movies without ever seeing these error messages), which makes me think maybe the problem is specific to this particular one?

Cheers,

Guillaume


Error in sys.excepthook:
Traceback (most recent call last):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 297, in ehook
    self.session.ui.thread_safe(self.report_exception, exc_info=exc_info)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 443, in report_exception
    self.info(tb_msg, is_html=True)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 388, in info
    self._log(Log.LEVEL_INFO, msg, add_newline, image, is_html,
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 498, in _log
    if log.log(*args):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 340, in log
    self.show_page_source()
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 344, in show_page_source
    self.session.ui.thread_safe(self._show)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 348, in _show
    self.regulating_timer.start(100)
RuntimeError: wrapped C/C++ object of type QTimer has been deleted

Original exception was:
Traceback (most recent call last):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 202, in cx_qt_msg_handler
    self.session.logger.method_map[log_level](msg_string)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 465, in warning
    self._log(Log.LEVEL_WARNING, msg, add_newline, image, is_html,
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 498, in _log
    if log.log(*args):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 340, in log
    self.show_page_source()
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 344, in show_page_source
    self.session.ui.thread_safe(self._show)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 348, in _show
    self.regulating_timer.start(100)
RuntimeError: wrapped C/C++ object of type QTimer has been deleted
Error in sys.excepthook:
Traceback (most recent call last):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 297, in ehook
    self.session.ui.thread_safe(self.report_exception, exc_info=exc_info)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 443, in report_exception
    self.info(tb_msg, is_html=True)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 388, in info
    self._log(Log.LEVEL_INFO, msg, add_newline, image, is_html,
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 498, in _log
    if log.log(*args):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 340, in log
    self.show_page_source()
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 344, in show_page_source
    self.session.ui.thread_safe(self._show)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 348, in _show
    self.regulating_timer.start(100)
RuntimeError: wrapped C/C++ object of type QTimer has been deleted

Original exception was:
Traceback (most recent call last):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 202, in cx_qt_msg_handler
    self.session.logger.method_map[log_level](msg_string)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 465, in warning
    self._log(Log.LEVEL_WARNING, msg, add_newline, image, is_html,
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 498, in _log
    if log.log(*args):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 340, in log
    self.show_page_source()
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 344, in show_page_source
    self.session.ui.thread_safe(self._show)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 348, in _show
    self.regulating_timer.start(100)
RuntimeError: wrapped C/C++ object of type QTimer has been deleted
Error in sys.excepthook:
Traceback (most recent call last):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 297, in ehook
    self.session.ui.thread_safe(self.report_exception, exc_info=exc_info)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 443, in report_exception
    self.info(tb_msg, is_html=True)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 388, in info
    self._log(Log.LEVEL_INFO, msg, add_newline, image, is_html,
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 498, in _log
    if log.log(*args):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 340, in log
    self.show_page_source()
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 344, in show_page_source
    self.session.ui.thread_safe(self._show)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 348, in _show
    self.regulating_timer.start(100)
RuntimeError: wrapped C/C++ object of type QTimer has been deleted

Original exception was:
Traceback (most recent call last):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 202, in cx_qt_msg_handler
    self.session.logger.method_map[log_level](msg_string)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 465, in warning
    self._log(Log.LEVEL_WARNING, msg, add_newline, image, is_html,
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/core/logger.py", line 498, in _log
    if log.log(*args):
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 340, in log
    self.show_page_source()
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 344, in show_page_source
    self.session.ui.thread_safe(self._show)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/ui/gui.py", line 366, in thread_safe
    func(*args, **kw)
  File "/Applications/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chimerax/log/tool.py", line 348, in _show
    self.regulating_timer.start(100)
RuntimeError: wrapped C/C++ object of type QTimer has been deleted

Attachments (1)

7otq_figure-2-supplement-2.cxc (3.1 KB ) - added by Tom Goddard 4 years ago.

Download all attachments as: .zip

Change History (9)

by Tom Goddard, 4 years ago

comment:1 by Tom Goddard, 4 years ago

Description: modified (diff)

I tried running the script from the command-line

~/Desktop/ChimeraX-1.2.5.app/Contents/MacOS/ChimeraX --exit ~/Downloads/7otq_figure-2-supplement-2.cxc

and did not get any errors. But the traceback you got makes it pretty clear that Qt issues an error when ChimeraX was shutting down and ChimeraX tried to report that error to the Log panel, but the Qt timer for the Log panel had already been destroyed. The Qt error should have been reported to the shell.

comment:2 by Tom Goddard, 4 years ago

My test was on macOS 11.6 while bug was reported on macOS 10.15.7.

comment:3 by pett, 4 years ago

On 10.15.7 I got these errors two out of three times with 1.2.5 and one out of three times with my personal 1.3 build. Seems to be Qt emitting a late message (into cx_qt_msg_handler).

comment:4 by pett, 4 years ago

Cc: pett added

in reply to:  6 comment:5 by goddard@…, 4 years ago

Ok, I tried a few more times and got it to happen once in 4 tries on ChimeraX 1.2.5 with macOS 11.6.  The Logger is not being shutdown fully before Qt is shutdown.  I'll try to remedy that now that I can reproduce it.

comment:6 by Tom Goddard, 4 years ago

The Qt error that is causing this is "Release of profile requested but WebEnginePage still not deleted. Expect troubles !".

comment:7 by pett, 4 years ago

Maybe call qInstallMessageHandler(0) during APP_QUIT?

comment:8 by Tom Goddard, 4 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

The "--exit" option was not cleaning up the gui by calling ui.quit() and instead just exited. The --exit option works by not running the Qt event loop. No "app quit" trigger is sent. Without proper cleanup a log message went to the GUI logger after its Qt timer had been deleted. I made "--exit" call ui.quit() which fires the "app quit" trigger and does proper cleanup.

Unfortunately this means three Qt warnings "Release of profile requested but WebEnginePage? still not deleted. Expect troubles !" go to the shell when using --exit.

Note: See TracTickets for help on using tickets.