RIDE icon indicating copy to clipboard operation
RIDE copied to clipboard

Blank squares left behind after a test run

Open JFoederer opened this issue 1 year ago • 19 comments

Some robot icons are being cleared in the tree view when running tests and the blank square is then persisted at its latest spot. There is at most one blank square added per test run. It is unclear what triggers this behaviour, it does not always happen.

The position of the blank squares is fixed with respect to the tree view window. This means that if you scroll inside the tree view, the blank squares scroll along. If you expand/collapse a test suite, then the blank square stays at its spot and is no longer with the test case it originated at.

image

JFoederer avatar Apr 04 '24 14:04 JFoederer

This was running RIDE 2.1dev23 on Windows with Python 3.11 and wxpython 4.2.1 I haven't noticed it on Linux yet.

JFoederer avatar Apr 04 '24 14:04 JFoederer

@JFoederer This is very unusual, and I doubt it has anything to deal with RIDE code. Maybe the problem is with wxPython. Do you think the processing resources are low when that happens?

HelioGuilherme66 avatar Apr 04 '24 16:04 HelioGuilherme66

Yes, it is unusual, but no, it was not at all heavy on the resources. If anything, it is the opposite. This was a test suite with very few dependencies. It runs 94 test cases in less than half a second.

JFoederer avatar Apr 04 '24 18:04 JFoederer

Having observed this issue for some time now, I do believe it only happens in very quick test runs where there is very little time to update the icons.

JFoederer avatar Sep 20 '24 13:09 JFoederer

I have some new info on this issue. I witnessed it happening in real-time, followed by a RIDE crash.

  • Consider a test suite consisting of 4 test cases,
  • running very fast, taking just milliseconds to complete
  • Updating the UI is a bit slower before the crash and I observe:
    • The first two tests are marked done with the green icon
    • The third test shows the lighter square, as shown in the initial issue description
    • From the fourth test the icon is removed altogether
    • RIDE freezes for a moment, than crashes
C:\Users\the_user\GitHub\robotframeworkMBT>C:\Users\the_user\AppData\Local\Programs\Python\Python312\python.exe -c "from robotide import main;main()"
DEBUG: project.py Project load_data robot version = b'7.2'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3427, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 435, in _set_icon_from_execution_results
    self._animctrl.Play()
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3427, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 435, in _set_icon_from_execution_results
    self._animctrl.Play()
RuntimeError: wrapped C/C++ object of type AnimationCtrl has been deleted
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3427, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 434, in _set_icon_from_execution_results
    self.SetItemWindow(node, self._animctrl, False)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\lib\agw\customtreectrl.py", line 4445, in SetItemWindow
    item.SetWindow(wnd, on_the_right)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\lib\agw\customtreectrl.py", line 2041, in SetWindow
    self._wnd.Enable(self._enabled)
RuntimeError: wrapped C/C++ object of type AnimationCtrl has been deleted

RIDE v2.2dev23 running on Python 3.12.0 using wxPython 4.2.2

JFoederer avatar Apr 30 '25 18:04 JFoederer

Upgrading to wxpython 4.2.3 shows slightly different results and takes a bit longer to crash.

I run the same test suite with 4 test cases, over and over. First there is a bunch of errors that do not result in a crash

AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 435, in _set_icon_from_execution_results
    self._animctrl.Play()
    ^^^^^^^^^^^^^^^^^^^

But also the RuntimeError shows up that appeared to cause the crash on wxpython 4.2.2

AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 434, in _set_icon_from_execution_results
    self.SetItemWindow(node, self._animctrl, False)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\lib\agw\customtreectrl.py", line 4442, in SetItemWindow
    item.SetWindow(wnd, on_the_right)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\lib\agw\customtreectrl.py", line 2038, in SetWindow
    self._wnd.Enable(self._enabled)
RuntimeError: wrapped C/C++ object of type AnimationCtrl has been deleted

And similar, but not identical, errors to the apparent harmless ones, that also cause RunTimeErrors, without crashing:

AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 414, in _set_icon_from_execution_results
    self._animctrl.Animation.Destroy()
    ^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: wrapped C/C++ object of type AnimationCtrl has been deleted

While repeating the same run over and over, I see every now and then icons being replaced by the blank squares. In order top-down. When the fourth and last icon is removed, RIDE crashes.

This is the last past of the trace logging from the console:

AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 434, in _set_icon_from_execution_results
    self.SetItemWindow(node, self._animctrl, False)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\lib\agw\customtreectrl.py", line 4442, in SetItemWindow
    item.SetWindow(wnd, on_the_right)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\lib\agw\customtreectrl.py", line 2038, in SetWindow
    self._wnd.Enable(self._enabled)
RuntimeError: wrapped C/C++ object of type AnimationCtrl has been deleted
Error in listener: Tree._test_result_0384, topic: ride.test.running

Traceback (most recent call last):
None
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\pubsub\core\topicobj.py", line 482, in __sendMessage
    listener(data, self, allData)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\pubsub\core\listener.py", line 237, in __call__
    cb(**kwargs)
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 391, in _test_result
    self._animctrl.Animation.Destroy()
    ^^^^^^^^^^^^^^^^^^^^^^^^
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 435, in _set_icon_from_execution_results
    self._animctrl.Play()
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 435, in _set_icon_from_execution_results
    self._animctrl.Play()
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'Play'
Traceback (most recent call last):
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\wx\core.py", line 3425, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\the_user\AppData\Local\Programs\Python\Python312\Lib\site-packages\robotide\ui\treeplugin.py", line 435, in _set_icon_from_execution_results
    self._animctrl.Play()
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'Play'

Do you notice:

  • the listener error?
  • how the last error did not complete its stacktrace logging?
  • The traceback starting with None in pubsub?

JFoederer avatar Apr 30 '25 18:04 JFoederer

Reproduced a second time with the exact same bahviour. Executing repeated runs and after some time the top icon turns blank, then a number of runs later the second and on to the third. When the last icon is hit: crash!

Image The last green was from the previous run, then it crashed.

JFoederer avatar Apr 30 '25 19:04 JFoederer

@JFoederer I could not reproduce this. Do you have a test suite that you can share?

The location of your Python, suggests it was installed from Microsoft Store. Mine Python 3.12 was installed from python.org and at path: C:\Python312.

HelioGuilherme66 avatar May 02 '25 19:05 HelioGuilherme66

Yes, this is a suite from an open source library I was working on. Load this folder into RIDE: https://github.com/JFoederer/robotframeworkMBT/tree/main/atest/robotMBT%20tests

The example was from this specific test suite, but it does not seem test suite specific. https://github.com/JFoederer/robotframeworkMBT/blob/main/atest/robotMBT%20tests/05__repeating_scenarios/07__repetition_with_refinement.robot

It appears to be related to the animated robot icon during very fast execution. If the tree view is collapsed, the crash does not happen.

JFoederer avatar May 02 '25 19:05 JFoederer

The Python installer came from python,org. I don't recall choosing anything custom during the install.

JFoederer avatar May 02 '25 19:05 JFoederer

Ok, in realising that this project does not have the most straight forward test suites I tried to reproduce the issue on some of the more basic test suites. Just to keep things simple.

But so far it seems that the 'simple' suites do not show the issues. But, as soon as a test suite is included that executes a test that is not present in the tree view, the issue pops up. Yes, it is possible to generate new test cases at runtime.

JFoederer avatar May 02 '25 19:05 JFoederer

@JFoederer I fixed the important part of the issue. Now it should not crash. I did reproduced the white squares (and also missing execution state icons) in the execution of the test suite from https://github.com/JFoederer/robotframeworkMBT

Because this is a corner case, I am inclined to mark this issue as fixed (no crash), and document that these blank squares may appear in certain executions.

Tested with RIDE v2.2dev29 in Windows 10 with Python 3.12, wxPython 4.2.3 and RF 7.2.2.

On Linux (Fedora 42) with Python 3.13.3, wxPython 4.2.4a15946+920a2bde and RF 7.2.2., did not get the blank icons, but test cases, did not change execution state indication (icons remained black). Test Suites with no state indication, were: robotframeworkMBT-main/atest/robotMBT tests/02__flatten_suite/03__Multiple_folder_suites/ robotframeworkMBT-main/demo/Titanic/

HelioGuilherme66 avatar May 28 '25 21:05 HelioGuilherme66

I am sorry to say the issue still occurs, @HelioGuilherme66. I am running RIDE v2.2dev29 on Windows 11 with Python 3.13.1, wxPython 4.2.3 and RF 7.2.2.

JFoederer avatar May 29 '25 14:05 JFoederer

I am sorry to say the issue still occur+

You mean the crash?

HelioGuilherme66 avatar May 29 '25 16:05 HelioGuilherme66

Yes indeed. Just like before. Blank squares followed by a crash. Although the crash can even occur when the suite is folded in from the tree view and the icons don't show.

JFoederer avatar May 29 '25 17:05 JFoederer

@JFoederer Please try again with 2.2dev34 (On Linux Fedora 42, KDE Plasma 6, Python 3.13, wxPython 4.2.4a15946+920a2bde, did not have crashes and icons changed colors)

HelioGuilherme66 avatar Jul 17 '25 20:07 HelioGuilherme66

Where can I find that wxPython version?

JFoederer avatar Jul 18 '25 09:07 JFoederer

Where can I find that wxPython version?

This was built on my Fedora 42. I have some builds at https://robotframework.transformidea.com/ I assume they only work on Linux systems. But for other systems you could take a look at https://wxpython.org

HelioGuilherme66 avatar Jul 18 '25 09:07 HelioGuilherme66

wxPython 4.2.4 seems a bit too new. On 4.2.3 it still fails on Windows with 2.2dev34

JFoederer avatar Jul 18 '25 15:07 JFoederer