Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Test suite randomly freezing since update to 10.15.1 #1734

Closed
sanders41 opened this issue Dec 1, 2021 · 4 comments
Closed

[BUG] Test suite randomly freezing since update to 10.15.1 #1734

sanders41 opened this issue Dec 1, 2021 · 4 comments

Comments

@sanders41
Copy link
Contributor

sanders41 commented Dec 1, 2021

Describe the bug

Since upgrading to Rich 10.15.1 I am seeing my test suites randomly get stuck. So far I have only noticed this when running tests and have not seen it when running programs outside of the tests. Here is one example. This issue is also happening in the Rich test suite (example here). The tests stop on the pytest step and never make any progress until GitHub Actions eventually time out.

I have also been able to reproduce this locally so it is not specific to GitHub Actions only. If I stop the tests with ctrl + c locally I get the following error (the full stack trace is really long so I'm only posting the last error, if more will help I can post it):

self = <console width=209 None>, live = <rich.live.Live object at 0x7f56051da200>

    def set_live(self, live: "Live") -> None:
        """Set Live instance. Used by Live context manager.
    
        Args:
            live (Live): Live instance using this Console.
    
        Raises:
            errors.LiveError: If this Console has a Live context currently active.
        """
        with self._lock:
            if self._live is not None:
>               raise errors.LiveError("Only one live display may be active at once")
E               rich.errors.LiveError: Only one live display may be active at once

.venv/lib/python3.10/site-packages/rich/console.py:813: LiveError

As far as I can tell the issue is random. It happens frequently, but I haven't been able to find a way to guarantee it happens.

Platform

Locally I am using Linux, but in GitHub Actions I have see the issue on Linux, Mac, and Windows.

I may ask you to cut and paste the output of the following commands. It may save some time if you do it now.

python -m rich.diagnose
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface.                                                  │
│                                                                                  │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=209 ColorSystem.TRUECOLOR>                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                  │
│     color_system = 'truecolor'                                                   │
│         encoding = 'utf-8'                                                       │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│           height = 50                                                            │
│    is_alt_screen = False                                                         │
│ is_dumb_terminal = False                                                         │
│   is_interactive = True                                                          │
│       is_jupyter = False                                                         │
│      is_terminal = True                                                          │
│   legacy_windows = False                                                         │
│         no_color = False                                                         │
│          options = ConsoleOptions(                                               │
│                        size=ConsoleDimensions(width=209, height=50),             │
│                        legacy_windows=False,                                     │
│                        min_width=1,                                              │
│                        max_width=209,                                            │
│                        is_terminal=True,                                         │
│                        encoding='utf-8',                                         │
│                        max_height=50,                                            │
│                        justify=None,                                             │
│                        overflow=None,                                            │
│                        no_wrap=False,                                            │
│                        highlight=None,                                           │
│                        markup=None,                                              │
│                        height=None                                               │
│                    )                                                             │
│            quiet = False                                                         │
│           record = False                                                         │
│         safe_box = True                                                          │
│             size = ConsoleDimensions(width=209, height=50)                       │
│        soft_wrap = False                                                         │
│           stderr = False                                                         │
│            style = None                                                          │
│         tab_size = 8                                                             │
│            width = 209                                                           │
╰──────────────────────────────────────────────────────────────────────────────────
python -m rich._windows
platform="Linux"
WindowsConsoleFeatures(vt=False, truecolor=False)
pip freeze | grep rich
rich                              10.15.1    Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal
@willmcgugan
Copy link
Collaborator

That does sounds suspiciously like a deadlock I thought I fixed in 10.15.0. Which I can't reproduce with 10.15.1, locally or with Github Actions. Although deadlocks are often hard to reproduce.

The tests you linked to in Rich were running in 10.15.0, which would explain the deadlock there.

The LiveError you get is due to nesting Live (or status or progress) instances, which won't work correctly. You could also get this if your test suite calls enter without a corresponding exit.

This could be a bug in Rich. Deadlocks are tricky. But since I can't reproduce it, I'd check your test suite first. Makes sure you aren't doing anything in the tests which might cause this. It's possible that 10.15.1 exposed a bug in your code.

Otherwise, a full traceback may help me diagnose the issue.

@willmcgugan
Copy link
Collaborator

I did manage to replicate this. Please try v10.15.2

@sanders41
Copy link
Contributor Author

I installed v10.15.2 and did several CI runs on a couple different repos and am not seeing the issue any more. Thanks for the fix!

@github-actions
Copy link

github-actions bot commented Dec 2, 2021

Did I solve your problem?

Consider sponsoring the ongoing work on Rich and Textual.

Or buy me a coffee to say thanks.

Will McGugan

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

No branches or pull requests

2 participants