Skip to content

Excessive D-Bus requests causing xdg-desktop-portal memory exhaustion #64

@gartmeier

Description

@gartmeier

Problem

The plugin appears to malfunction and send bursts of hundreds of D-Bus requests to query the system color scheme, instead of respecting the configured update_interval. This causes xdg-desktop-portal to exhaust system memory, leading to system freezes and OOM killer interventions.

Environment

  • OS: Fedora 42
  • Neovim version: 0.11.3
  • auto-dark-mode.nvim version: branch master - commit 97a86c9
  • Desktop Environment: GNOME

Configuration

{
  'f-person/auto-dark-mode.nvim',
  priority = 1100,
  opts = {
    update_interval = 1000,
    set_dark_mode = function()
      vim.api.nvim_set_option_value('background', 'dark', {})
      vim.cmd.colorscheme 'catppuccin-mocha'
    end,
    set_light_mode = function()
      vim.api.nvim_set_option_value('background', 'light', {})
      vim.cmd.colorscheme 'catppuccin-latte'
    end,
  },
},

Expected Behavior

The plugin should query org.freedesktop.appearance color-scheme once every 1000ms as configured.

Actual Behavior

The plugin sends requests in rapid bursts - hundreds of requests within seconds, especially after the system has been idle for a few minutes. Instead of one request per second, it appears to queue up requests and fire them all at once.

Reproduction Steps

  1. Install the plugin with the above configuration
  2. Leave Neovim running
  3. Monitor D-Bus traffic: dbus-monitor --session "destination='org.freedesktop.portal.Desktop'"
  4. Observe normal behavior initially (1 request/second)
  5. Leave the system idle for a few minutes
  6. Return to see burst patterns of hundreds of rapid requests

Impact

  • xdg-desktop-portal-gnome memory usage grows unbounded
  • System becomes unresponsive
  • OOM killer eventually terminates xdg-desktop-portal
  • Affects system stability for users running Neovim for extended periods

Debugging Information

D-Bus monitor output showing the burst pattern:

signal time=1736250837.509974 sender=org.freedesktop.DBus -> destination=:1.59594 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
method call time=1736250837.510056 sender=:1.59594 -> destination=org.freedesktop.portal.Desktop serial=3 path=/org/freedesktop/portal/desktop; interface=org.freedesktop.portal.Settings; member=ReadOne
[Pattern repeats hundreds of times within seconds]

Workaround

Currently had to disable the plugin entirely to prevent system instability.

Additional Context

This issue was discovered while investigating widespread xdg-desktop-portal memory leaks affecting multiple users. While there may be an underlying issue with xdg-desktop-portal's memory management, the plugin should not generate this volume of requests regardless.

Related xdg-desktop-portal issue: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/118#note_2544608

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions