Skip to content

Opening large amount of tests in RIDE folder tree freezes #1668

Closed

Description

@Rochet2

I have a directory that contains 800 tests.
Those tests are foldered into multiple folders that have subfolders and so on.
If I open multiple folders / suites that contain tests at the same time, RIDE starts to freeze the whole computer.

I did not seem to notice any change in RAM or CPU usage.
The freezing happens so that when you are in RIDE and click on something - anything: a button in RIDE, some other program on task bar - anything.
The freezing can take from some seconds to for example 10 seconds or possibly more. Usually it is a relatively long time.
Once the freezing happens once, it happens from that point onwards until RIDE is closed and opened again.

You can try to reproduce this by having a directory that contains 5 folders.
Those folders contain 10 suites each.
The suites contain 1 to 10 tests each.
(Ok, lets just say that the whole left folder tree in RIDE is full of suites and tests. Completely white - having 40 suites open or similar)
When you open all this up in RIDE it will start to freeze. It may require a bit of waiting or fiddling around or trying to click on RIDE and some other program and then RIDE again multiple times or clicking something in RIDE to get the freezing to start happening.

It seems that I am not the only one having this problem as I have witnessed others having it as well.

We all used the latest release, which is https://github.com/robotframework/RIDE/releases/tag/v1.5.2.1

RIDE is a nice tool compared to maintaining things manually in the text files - but this freezing keeps interrupting work and forces restarting RIDE multiple times every day.

With the folder tree I mean the left side of RIDE
ride_1

Activity

  1. Rochet2 commented on May 20, 2017

    @Rochet2
    Author

    tests.zip
    Here is an example of some test data you can use to try freeze your RIDE.
    It contains 160 folders that have 10 suits that have 10 tests each.

    To use the data simply place it somewhere, open RIDE, click to open directory in RIDE and select the Tests folder. To test the freeze simply scroll the tree view up and down once by grabbing the scroll bar with your mouse and then try to change the window focus to any other program, like notepad for example. The system should freeze and you cannot do anything.

    I tried profiling RIDE and disabling everything that seemed like a problem, but the freeze still exists.
    I disabled for example _sendMessage in publisher entirely as it was called 100 000 times.

    The profiling would suggest that the whole program time is almost entirely (not counting data loading) spent in the GUI MainLoop
    diagram

  2. HelioGuilherme66 commented on May 21, 2017

    @HelioGuilherme66
    Member

    I do confirm that this long tree of tests causes application freeze. In my system (Linux) the scrolling of the tree did not cause the freeze, but it happened when right-click and Select All Tests or Unselect All Tests.

    There is an alternate version of RIDE in my fork (which includes some fixes, but not related to the tree). You may experiment it, to see if it makes any difference. Please note, that using wxPython 2.8.12.1 there should not be any unknown bugs, but with newer wxPython there are some.

    1600_tests_ride

  3. Rochet2 commented on May 21, 2017

    @Rochet2
    Author

    I tested with all
    31c8903 (latest release)
    dcdccfe (latest source in github)
    HelioGuilherme66@baf4bf1 (your fork latest release)
    and the issue happens on all of them. I did not test the latest source from your repo since it requires newer invoke.
    The latest RIDE source could not run the tests in the folders that had hypens in their names but the latest release from you and in RIDE repo can. The nice thing about your version was that utf8 errors dont appear in console even though the output still cannot handle the hypens in the folder names.

    The way select all tests and similar actions have been coded certainly introduces a lot of lag. (expand all tree items and collapse them)
    But that is not an issue for me/us as it happens only when you try to select a bunch of tests, so it happens when you expect it to happen and it will only freeze RIDE so you can still access other programs (which this issue we are in does not allow). Most of the time I/we dont run huge amounts of tests through RIDE, we only develop using RIDE so only small amounts of tests are run usually. RIDE has nice capabilities for selecting tests, pausing, stepping, editing documentation of tests and such.

    Do note that the freeze in this issue does not only cause RIDE to freeze like selecting all tests does.
    Instead the whole computer freezes when you select some other window as active in the windows UI. I believe RIDE is somehow making a huge deal of rendering something or similar. Its hard to analyse this as the whole windows UI is frozen, but I think the window management process was elevated for a moment in the task manager.

  4. Rochet2 commented on May 23, 2017

    @Rochet2
    Author

    A small update:
    I did some searching and found that after this change there seems to be no freeze:
    C:\Python27\Lib\site-packages\robotide\ui\tree.py

        def _create_node_with_handler(self, parent_node, controller, index=None):
            handler_class = action_handler_class(controller)
            node = self._create_node(parent_node, controller.display_name, self._images[controller],
                                     index, with_checkbox=(handler_class == TestCaseHandler and self._checkboxes_for_tests))
            if isinstance(controller, ResourceFileController):
                if not controller.is_used():
                    self.SetItemTextColour(node, wx.ColorRGB(0xA9A9A9))
    -        self.SetPyData(node, handler_class(controller, self, node, self._controller.settings))
    +        self.SetPyData(node, None if handler_class is TestCaseFileHandler else handler_class(controller, self, node, self._controller.settings))
            if controller.is_excluded():
                self._set_item_excluded(node)
            return node

    Basically I made the action handler to be None for when it would use TestCaseFileController.

    I tried changing None to wx.Window(self) as that seemed to be the class that TestCaseFileHandler inherited from at the very bottom, but the freeze still happened with it. ( I basically tried to remove all RIDE related code from the handler by doing this )

    I tried to print how many of each controller was used and 3260, a huge amount, used TestCaseFileHandler.

  5. narayanyadav007 commented on Oct 25, 2018

    @narayanyadav007

    Hi Rochet2,

    Your solution of adding below line is not working
    self.SetPyData(node, None if handler_class is TestCaseFileHandler else handler_class(controller, self, node, self._controller.settings))

    Throws error for 'TestCaseFileHandler'.

    Could you please help.... Getting frustated with slow response on windows 10 :(

    OR Can anybody help me on this ???

  6. added
    enhancement
    help_wanted
    on May 23, 2019
  7. added
    prio-high
    on Jun 10, 2019
  8. pakal commented on Sep 20, 2019

    @pakal

    Maybe have a look at #2017 and tell if this bugfix helps in your case

  9. HelioGuilherme66 commented on Sep 20, 2019

    @HelioGuilherme66
    Member

    @pakal The fix you propose is on code that was added much after 1.5.2.1.

  10. Nyral commented on Sep 20, 2019

    @Nyral
    Contributor

    The fix mentioned by pakal is not related to this issue.

  11. Nyral commented on Dec 13, 2019

    @Nyral
    Contributor

    Do note that the freeze in this issue does not only cause RIDE to freeze like selecting all tests does. Instead the whole computer freezes when you select some other window as active in the windows UI. I believe RIDE is somehow making a huge deal of rendering something or similar. Its hard to analyse this as the whole windows UI is frozen, but I think the window management process was elevated for a moment in the task manager.

    @Rochet2 @Soothsilver @HelioGuilherme66

    I managed to figure out a few other things about this issue.

    • The 'freeze' doesn't actually affect windows, it only seems to prevent/delay all mouse events from taking action). You can test this by leaving a video running.
    • After the 'freeze' is over, all mouse events that were being delayed are released and take effect.
    • It's not necessary to click on another window, simply moving the mouse outside the RIDE frame causes it to occur. When doing this, EVT_MOTION is sent.
    • Keeping the mouse inside the RIDE frame will not trigger the 'freeze'.
    • The issue is definitely related in some way to the tree. When scrolling, a delay builds up. As long as you keep the mouse pointer inside the frame, it will expend in the background and you will be able to edit tests as you do normally, without any 'freeze'. But if you move the mouse outside the window, while this internal delay hasn't finished, then the 'freeze' will occur.
  12. Soothsilver commented on Dec 16, 2019

    @Soothsilver

    Okay, wow, good job. Now I really want to know what's causing this.

    Somebody could also send this to Microsoft. It could be a bug in Windows and we now have a perfect repro case, even if it's somewhat involved.

    (This seems related to #1843.)

  13. Nyral commented on Dec 17, 2019

    @Nyral
    Contributor

    @Soothsilver Thanks, but I still need to separate the tree from RIDE first, in order to eliminate any other possibility.

    (This seems related to #1843.)

    Yes, it's the same issue. We should probably merge them at some point.

  14. valeriobruno commented on May 8, 2020

    @valeriobruno
    Contributor

    Hello guys.

    I've spent some time with casca to reproduce the issue on the current master version.

    We have opened a directory containing many tests (thousands).

    Loading the directory takes about 1 minute (which might be acceptable).

    We opened 3 nodes so to have about 20-30 nodes visible.

    We have observed two bad behaviors.

    1. When we try to scroll on the "Test Suites" tree, RIDE and Windows 10 freeze for a couple of minutes.
      If we try the same on Mac OS X 10.15, we observe slowness on the response of the scroll (which suggests heavy computation) but the rest of the OS GUI remains responsive.

    2. if we right click on the root and "Select All Tests", RIDE and Windows freeze for several minutes (>15 minutes).
      The same scenario on Mac freezes RIDE for about the same time. The OS GUI remains responsive.

    The general impression is that the UI is better segregated on Mac, compared to Window.

    Replicating the second scenario, we have stopped the execution with the debugger. And that showed the following stack of the Main thread.
    threads

    We're not Python experts, but the select all tests causes to

    • Expand recursively all the sub-nodes
      • Which causes the rendering of the sub-nodes.

    At the end all the expanded nodes are collapsed back.

    treeplugin.py

        def _for_all_tests(self, item, func):
            item_was_expanded = self.IsExpanded(item)
            if not self.HasAGWFlag(customtreectrl.TR_HIDE_ROOT) or \
                    item != self.GetRootItem():
                if isinstance(item.GetData(), ResourceRootHandler or
                   ResourceFileHandler):
                    return
    
                is_item_expanded = self.IsExpanded(item)
                if not is_item_expanded:
                    self.Expand(item)
                if self._is_test_node(item):
                    func(item)
                if not self.IsExpanded(item):
                    return
    
            for child in item.GetChildren():
                self._for_all_tests(child, func)
    
            if not item_was_expanded:
                self.Collapse(item)

    Does anybody know why we expand all the sub-nodes, when we really want just to select (ie graphically highlight) the currently expanded nodes?

    cc: @HelioGuilherme66

    Thanks.

  15. 5 remaining items

  16. HelioGuilherme66 commented on Jun 10, 2020

    @HelioGuilherme66
    Member

    @valeriobruno Unfortunatelly the same testing did not work on Windows.

    We have in master, since today, a fix to allow staring RIDE with Tree or File Explorer panels disabled or hidden. This allowed to have a loading time before stabilization of 9 seconds (on the previous system and test folder). This is the chart:
    image

    Assuming that the behavior is the same on Windows, users can hide the Tree panel, before loading large test suites folders, of they must enable it again when wanting to navigate on files or test suites.

  17. valeriobruno commented on Jun 16, 2020

    @valeriobruno
    Contributor

    Pull request: #2210

  18. HelioGuilherme66 commented on Jun 18, 2020

    @HelioGuilherme66
    Member

    @valeriobruno @Rochet2 @Soothsilver @Nyral Great news. The freeze is gone with @valeriobruno PR.
    See here:
    Before fix:
    Current_master_tree_selection_RIDE
    After fix:
    Fixed_master_tree_selection_RIDE

    My system: Windows 7 Professional x64, Python 3.7.6, wxPython 4.0.7.post2, RF 3.2.1.

  19. Soothsilver commented on Jun 18, 2020

    @Soothsilver
  20. HelioGuilherme66 commented on Jun 18, 2020

    @HelioGuilherme66
    Member

    I think so. I did scrolled, it was a bit slow, but no crash.

  21. valeriobruno commented on Jun 18, 2020

    @valeriobruno
    Contributor

    Great news!! Does this also fix the freeze-upon-scrolling problem?

    It should at least reduce the scrolling problem. With this fix, only the nodes explicitly opened by the user are attached to the WX Tree. Therefore, the WX Tree must handle few nodes (as opposed to ALL).

  22. jnhyperion commented on Jul 20, 2020

    @jnhyperion
    Contributor

    with this PR: #2237

    this issue should be totally resolved.

  23. added this to the v2.0 milestone on Jul 20, 2020
  24. added
    fixed
    and removed
    help_wanted
    on Jul 20, 2020
  25. IlfirinPL commented on Oct 8, 2020

    @IlfirinPL

    @HelioGuilherme66
    I have recently try to open project ( 500+ test cases and many resources ) using most recent sources (Oct 3, 2020) from RIDE using Python 3.8.

    Total time increase from less than 30 sec to more then 5 mins

    Using profile command
    python -m profile -o ride.profile -s tottime -m robotide.init

    its show most of time is related with "~:0(<method 'acquire' of '_thread.lock' objects>)"

    image
    I have attached profile file
    ride.profile.zip

  26. HelioGuilherme66 commented on Oct 8, 2020

    @HelioGuilherme66
    Member

    @jnhyperion Ping. Please take a look to this, thanks.

  27. IlfirinPL commented on Apr 6, 2021

    @IlfirinPL

    @HelioGuilherme66 I can confirm latest changes improve performance tremendous ( now now open under 3 sec vs 5 min)

  28. HelioGuilherme66 commented on Apr 6, 2021

    @HelioGuilherme66
    Member

    @IlfirinPL Great. Thanks for the feedback.
    The fix was made by @JFoederer so all the credits goes to him!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfixedprio-high

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions