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] nwg-panel hangs after period of time #225

Closed
kuba3351 opened this issue May 17, 2023 · 12 comments
Closed

[BUG] nwg-panel hangs after period of time #225

kuba3351 opened this issue May 17, 2023 · 12 comments

Comments

@kuba3351
Copy link

Describe the bug
I can see never versions of nwg-panel started to hang on Fedora. After launch, nwg-panel works normally, but works slover over time, and then hangs completety.

To Reproduce
Steps to reproduce the behavior:

  1. Run nwg-panel on Fedora 38
  2. Wait some time

Expected behavior
Nwg-panel should not hang

Screenshots
While executing top, I can see something like this:
screen-latest

Desktop (please complete the following information):

  • Linux distribution: Fedora 38
  • Sway version sway -v: 1.8.1
  • Panel version nwg-panel -v: 0.9.1
@kuba3351 kuba3351 changed the title [BUG]nwg-panel hangs after period of time [BUG ]nwg-panel hangs after period of time May 17, 2023
@kuba3351 kuba3351 changed the title [BUG ]nwg-panel hangs after period of time [BUG] nwg-panel hangs after period of time May 17, 2023
@nwg-piotr
Copy link
Owner

nwg-piotr commented May 17, 2023

Well, I've been working for 4+ hours now with 4 instances of panel running (v0.9.2, Arch), and nothing hung so far. You need to gather more info, please. Also upgrade the panel to the current version, if possible.

@kuba3351
Copy link
Author

I will upgrade nwg-panel when the newest version will be packaged.

But, I am seeing this issue wth a few recent versions of nwg-panel, and tried to fire this issue before but had an issue with creating an issue :) (500 error code form Github)

I can provide any information you need about this, just describe how can I help.

@nwg-piotr
Copy link
Owner

The most wanted it the module that causes the issue. Could you try running the panel with just certain modules turned on?

@kuba3351
Copy link
Author

You mean running it with default config? Yes I can, and I will check if it will hang or not.

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 17, 2023

Or you may turn off modules that you use one by one.

@kuba3351
Copy link
Author

Ok, I used nwg-panel for a while on default config and it works fine. So, you are right that there is an issue with a module. So I will experiment with disabling module and let you know when I will investigate which module causes the problem. Thank you.

@nwg-piotr
Copy link
Owner

I've been using the panel w/ sway for an hour or so. Lately it doesn't happen to me often, as I'm working on Hyprland-related stuff. One way or another, nothing hags so far. Maybe some of your executors is the culprit?

@kuba3351
Copy link
Author

I found the issue.

I ran strace to investigate what nwg-panel is doing and seen a lot of messages complaining there is no file /home/jsierzega/.config/nwg-panel/icons_light/icon-theme.cache. When i crfeated the file by using touch and restarted nwg-panel it works fine.

@nwg-piotr
Copy link
Owner

nwg-piotr commented May 30, 2023

I remember having some issue resolved by running gtk-update-icon-cache, but it was long time ago, and I have no idea what exactly didn't work. But I have no icon-theme.cache file in panel custom icon dirs.

@nwg-piotr
Copy link
Owner

I've just added these files in default folders content. Thanks for investigating the problem.

@moetayuko moetayuko mentioned this issue Jul 8, 2023
@moetayuko
Copy link
Contributor

I assume that the root cause of this issue is incorrect uses of Gdk.threads_add_timeout and GLib.timeout_add.

We use them to schedule periodic tasks, expecting the next run to be launched after the given interval after the last run is finished, but these functions don't work in such a way. Instead, the interval specifies the time between launches of the task.

For instance, if a task takes 300ms to finish and the specified interval is 500ms, the time between the last finish and the next start is only 200ms. If the task takes >500ms to finish, the next run will be launched immediately after the last run is finished! This can be verified with the following program, in which the task takes 3s to finish while the interval is 1s:

from gi.repository import GLib
import time


class Runner:

    def __init__(self, num_times):
        self.num_times = num_times
        self.count = 0

    def __call__(self, *args):
        self.count += 1
        print("Periodic timer [{}]: args={}".format(self.count, args))
        time.sleep(3)
        print("Periodic timer [{}] end".format(self.count))

        return self.count < self.num_times


run = Runner(5)

interval_ms = 1000
GLib.timeout_add(interval_ms, run, 'foo', 123)

loop = GLib.MainLoop()
loop.run()

To fix this issue, we may need to carefully revise the use of these timeout functions. I proposed #239 to fix an obvious use, which schedules the next run at the end of the current run, but it may have room for improvement.

@nwg-piotr
Copy link
Owner

I assume this to be resolved. Please reopen if I'm wrong.

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

No branches or pull requests

3 participants