gtg icon indicating copy to clipboard operation
gtg copied to clipboard

Infinite loop of errors under GTK<4.10 after recent commit

Open SqAtx opened this issue 10 months ago • 5 comments

After https://github.com/getting-things-gnome/gtg/commit/23a986847a61f4744a1e9a323a4f5b353358d2e5, opening GTG results in some sort of infinite loop of errors that spawns the "something unexpected happened" dialog continuously and makes it difficult to close GTG.

This is the end of my logs:

Gtk-Message: 08:52:07.152: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.156: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.160: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.165: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.169: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.173: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.177: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.181: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.185: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.189: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.194: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.199: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.204: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.209: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.215: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.220: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.226: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.231: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.236: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.241: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.245: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.250: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.255: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.260: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.264: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.269: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'
Gtk-Message: 08:52:07.273: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 406, in task_setup_cb
    box = TaskBox(self.app.config, self.pane == 'workview')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 44, in __init__
    self.expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:52:07.278: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source>>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/task_pane.py", line 488, in task_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'

This does no happen on the previous commit (with the same dataset).

SqAtx avatar Apr 22 '24 15:04 SqAtx

I am trying to reproduce the crash. Could you please provide more details about your setup? Does this happen with the default dataset? What is your exact GTK version?

There are two different errors:

  • AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth' Based on the GTK documentation, this method is present from version 4.10. Is it possible that you have an older version?

  • AttributeError: 'NoneType' object has no attribute 'get_first_child' Maybe this is just a consequence of the first error. Could you please try to capture the beginning of your error message?

gycsaba96 avatar Apr 23 '24 15:04 gycsaba96

Thanks for looking at it! I have GTK 4.8.3, which seems to explain the problem. Let's make 4.10 an explicit requirement then (here, I think? and in the README).

It happens with the default dataset as well.

Could you please try to capture the beginning of your error message?

I'll try that when I have a minute! I assume I just need to disable the code that catches the exception and opens the dialog.

Side note: I'll probably create new issue for this, but I'd like to avoid "infinite dialogs" as a failure mode. Probably by detecting whether the error dialog is already open, and avoiding to open a new one.

SqAtx avatar Apr 23 '24 16:04 SqAtx

I'll try that when I have a minute! I assume I just need to disable the code that catches the exception and opens the dialog.

You can also just redirect the error output to a file like this:

./launch.sh 2> output.txt

Then hit Ctrl + C in the terminal to exit GTG.

gycsaba96 avatar Apr 23 '24 17:04 gycsaba96

It seems that I had the entire thing before - this is the start of the log:

2024-04-29 08:48:03,485 - WARNING - __init__:__init__:68 - Backend backend_caldav could not be loaded: ModuleNotFoundError("No module named 'caldav'")
Gtk-Message: 08:48:03.674: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source >>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/sidebar.py", line 286, in tags_setup_cb
    expander.set_indent_for_depth(True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TreeExpander' object has no attribute 'set_indent_for_depth'. Did you mean: 'set_indent_for_icon'?
Gtk-Message: 08:48:03.678: GtkDialog mapped without a transient parent. This is discouraged.
Traceback (most recent call last):
  File "<< GTG source >>/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/sidebar.py", line 355, in tags_bind_cb
    expander = box.get_first_child()
               ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_first_child'

and then everything repeats except the first line.

So, two things I'd like to do here:

  • Require GTK 4.10 explicitly
  • Avoid opening an exception dialog when one is already open

SqAtx avatar Apr 29 '24 15:04 SqAtx

Some notes with my current understanding of the problem:

  1. The TaskPane is created
  2. It connects some "setup" signal to task_setup_cb()
  3. task_setup_cb() is called
  4. It tries to create a TaskBox
  5. The constructor of TaskBox calls self.expander.set_indent_for_depth(True), which raises an AttributeError in GTK<4.10
  6. task_setup_cb() propagates the exception
  7. It gets caught by the replacement_excepthook, which creates and opens the ExceptionHandlerDialog
  8. Meanwhile, the "setup" signal is sent again, and we're back at step 3

Being on GTK 4.10 means that step 5 doesn't fail, but any exception in the TaskBox constructor has the same effect.

My current idea is to not open the ExceptionHandlerDialog of step 7 if one is already open.

SqAtx avatar May 25 '24 22:05 SqAtx

I wanted do_error_dialog() to realize that a dialog is already open, either by somehow looking at a list of opened dialogs or with a dumb boolean. But it can't just do nothing in that case, because then it would swallow the second exception. And we can be in a scenario where I click "Continue" on the dialog for Exception 1 because I think I can deal with it, but don't have the opportunity to close GTG after Exception 2.

So instead, it would be best to wait for the dialog to close before opening a new one. I'm thinking of using a queue. With a finite size, given that there can be an infinite number of exceptions and we don't want to fill an infinite queue and crash GTG.

SqAtx avatar Jul 06 '24 23:07 SqAtx