[kde] [Bug 509887] New: Unloading search plugins crashes on Akonadi shutdown

bugzilla_noreply at kde.org bugzilla_noreply at kde.org
Wed Sep 24 21:22:30 BST 2025


https://bugs.kde.org/show_bug.cgi?id=509887

            Bug ID: 509887
           Summary: Unloading search plugins crashes on Akonadi shutdown
    Classification: I don't know
           Product: kde
      Version First unspecified
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: jshand2013 at gmail.com
  Target Milestone: ---

# Unloading search plugins crashes on Akonadi shutdown

**Severity:** High  
**Area:** Server / SearchManager  

## Description
`SearchManager` contains a FIXME noting that unloading search plugins "messes
up some global statics from client libs" and causes a crash on shutdown. As a
workaround, plugins are kept loaded.

## Evidence
/mnt/data/akonadi_extracted/akonadi/src/server/search/searchmanager.cpp lines
93–101:

```
  93|     qDeleteAll(mPlugins);
  94|     /*
  95|      * FIXME: Unloading plugin messes up some global statics from client
libs
  96|      * and causes crash on Akonadi shutdown (below main). Keeping the
plugins
  97|      * loaded is not really a big issue as this is only invoked on server
shutdown
  98|      * anyway, so we are not leaking any memory.
  99|     Q_FOREACH (QPluginLoader *loader, mPluginLoaders) {
 100|         loader->unload();
 101|         delete loader;
```

## Steps to Reproduce
1. Run akonadiserver with search plugins loaded.
2. Initiate server shutdown that triggers `SearchManager` destructor.
3. Attempt to unload plugins (if workaround removed) or observe persistent
plugin loaders not being released.

## Expected Behavior
OS Details:

Operating System: openSUSE Tumbleweed 20250923
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.2
Kernel Version: 6.16.8-1-default (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ 7 150U
Memory: 16 GiB of RAM (15.3 GiB usable)
Graphics Processor: Intel® Graphics
Manufacturer: Dell Inc.
Product Name: Inspiron 16 5640

Plugins can be unloaded cleanly during shutdown without crashing; resources are
released.

## Actual Behavior
Unloading plugins leads to a crash due to global statics; code avoids unloading
to prevent crash.

## Suggested Fix / Next Steps
- Identify offending global statics in client libs that rely on plugin code
during shutdown.
- Defer plugin unloading until after dependent statics are torn down, or
refactor to avoid cross-library global state.
- Consider using `qAddPostRoutine`/`Q_COREAPP_STARTUP_FUNCTION` lifecycle hooks
or managing plugin lifetimes via a dedicated singleton whose teardown ordering
is explicit.
- Add regression test that loads and unloads plugin within a minimal server
lifecycle.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list