PixlOne / logiops

An unofficial userspace driver for HID++ Logitech devices
GNU General Public License v3.0
3.42k stars 271 forks source link

Large memory consumption in logid #377

Closed Barabazs closed 1 year ago

Barabazs commented 1 year ago

I noticed that logid seams to be hogging a lot of memory since I updated to the latest version.

OS: Ubuntu 22.04.2 LTS kernel: 5.19.0-41-generic logid version: v0.3.1

image

PixlOne commented 1 year ago

Seems to be a memory leak, could you post your config and logs?

Barabazs commented 1 year ago

Here is my config:

devices: ({
  name: "Wireless Mouse MX Master 3";
  smartshift:
  {
      on: true;
      threshold: 10;
      default_threshold: 30;
  };
  dpi: 3100;
  })

Where are the logs for logid stored?

I did found this in the "Logs" application:

 9 mei 17:48:24 kernel: Out of memory: Killed process 1996170 (logid) total-vm:23991604kB, anon-rss:20345592kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:41456kB oom_score_adj:0
 9 mei 11:48:51 kernel: Out of memory: Killed process 1339425 (logid) total-vm:14030132kB, anon-rss:13010196kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:26504kB oom_score_adj:0
 8 mei 15:27:28 kernel: Out of memory: Killed process 2308625 (logid) total-vm:22222132kB, anon-rss:17266928kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:35940kB oom_score_adj:0
PixlOne commented 1 year ago

Run sudo journalctl -u logid to get the logs

Barabazs commented 1 year ago

I grepped for today and I have 15204 lines which consists of 15051 lines saying [INFO] /dev/hidraw3:1 woke up.

Tail of the log:

mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:33 nan logid[463433]: [INFO] /dev/hidraw3:1 woke up.
mei 12 10:12:47 nan logid[463433]: [INFO] /dev[ERROR] Failed to add device 1 to receiver on /dev/hidraw3: sendReport write failed: Broken pipe
mei 12 13:23:09 nan systemd[1]: Stopping Logitech Configuration Daemon...
mei 12 13:23:10 nan systemd[1]: logid.service: Deactivated successfully.
mei 12 13:23:10 nan systemd[1]: Stopped Logitech Configuration Daemon.
mei 12 13:23:10 nan systemd[1]: logid.service: Consumed 1min 23.265s CPU time.
mei 12 13:23:10 nan systemd[1]: Started Logitech Configuration Daemon.

I restarted the service at 13:23.

PixlOne commented 1 year ago

Can you try out the fix-wakeup-memleak branch and let me know if that fixes it? I believe I've determined the issue.

Barabazs commented 1 year ago

Can you try out the fix-wakeup-memleak branch and let me know if that fixes it? I believe I've determined the issue.

I tried that branch, but it didn't fix the issue. Over a span of 1 hour, I got 11599 x ... logid[2373905]: [INFO] /dev/hidraw4:1 woke up.

PixlOne commented 1 year ago

Can you try out the latest commit on that branch? @Barabazs I'm having trouble reproducing this bug personally.

Barabazs commented 1 year ago

Can you try out the latest commit on that branch? @Barabazs I'm having trouble reproducing this bug personally.

I have been running the latest changes for a few hours and it's still working smoothly. I'll keep running this version, but this looks promising. Thank you! :pray:

PixlOne commented 1 year ago

I'm going to merge this for now and close the issue, please re-open if this persists.

Barabazs commented 1 year ago

Hey @PixlOne I just wanted to let you know that it's still running smoothly.