Skip to content

Database export taking upwards of 20 seconds #2697

@swills

Description

@swills

Versions

  • Pi-hole: v6.1.4
  • Web: v6.2.1
  • FTL: v6.2.3

Platform

  • OS and version: Linux 6.12.43
  • Platform: Talos

I noticed that Pihole had started to hang periodically and after some troubleshooting turned on debugging. Here are some relevant logs:

2025-11-06 03:54:25.414 UTC [54/T171] DEBUG_DATABASE: Exported 0 rows for disk.query_storage (took 25331.0 ms, last SQLite ID 15293262)
2025-11-06 03:55:22.111 UTC [54/T171] DEBUG_DATABASE: Exported 71 rows for disk.query_storage (took 22034.2 ms, last SQLite ID 15293404)
2025-11-06 03:56:23.988 UTC [54/T171] DEBUG_DATABASE: Exported 0 rows for disk.query_storage (took 23913.9 ms, last SQLite ID 15293333)
2025-11-06 03:57:24.162 UTC [54/T171] DEBUG_DATABASE: Exported 55 rows for disk.query_storage (took 24093.2 ms, last SQLite ID 15293443)
2025-11-06 03:58:23.516 UTC [54/T171] DEBUG_DATABASE: Exported 0 rows for disk.query_storage (took 23457.7 ms, last SQLite ID 15293388)
2025-11-06 03:59:22.760 UTC [54/T171] DEBUG_DATABASE: Exported 44 rows for disk.query_storage (took 22677.1 ms, last SQLite ID 15293476)
2025-11-06 04:00:21.945 UTC [54/T171] DEBUG_DATABASE: Exported 49 rows for disk.query_storage (took 21855.9 ms, last SQLite ID 15293574)
2025-11-06 04:01:21.107 UTC [54/T171] DEBUG_DATABASE: Exported 69 rows for disk.query_storage (took 21015.7 ms, last SQLite ID 15293713)

Looks like exporting the DB is taking ~20 seconds.

Note that this is running inside Kubernetes with /etc/pihole on Ceph storage, specifically CephFS (not rbd, nfs, etc.). Perhaps not a supported platform and that's fine, I'm happy to bump database.DBinterval up from the default 60 seconds and otherwise ignore infrequent issues.

That said, I think that the problem may be somewhat simple to fix, since I suspect it's an fsync() issue due to the fact that SQLite does fsync by default (without pragma synchronous = off) and CephFS is very conservative about ensuring all copies are written to disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions