Skip to content

collect_buffercache_metrics crashes DB on PostgresSQL Aurora 17 #21633

@billoneil

Description

@billoneil

I don't believe this is an issue with DataDog's agent but it might be worth updating documentation / adding a note that this is a potential issue.

I have an open support ticket with AWS and will follow up if I get more details.

postgresql.log.2025-10-11-1300:2025-10-11 13:48:17 UTC::@:[596]:LOG:  server process (PID 1031) was terminated by signal 7: Bus error

More logs

postgresql.log.2025-10-11-1300:2025-10-11 13:48:17 UTC::@:[596]:LOG:  server process (PID 1031) was terminated by signal 7: Bus error
postgresql.log.2025-10-11-1300-2025-10-11 13:48:17 UTC::@:[596]:DETAIL:  Failed process was running: /* service='datadog-agent' */ WITH buffer_by_relfilenode AS (
postgresql.log.2025-10-11-1300-	    SELECT reldatabase, relfilenode,
postgresql.log.2025-10-11-1300-	        NULLIF(COUNT(CASE WHEN relfilenode IS NOT NULL THEN 1 END), 0) as used,
postgresql.log.2025-10-11-1300-	        COUNT(CASE WHEN relfilenode IS NULL THEN 1 END) as unused,
postgresql.log.2025-10-11-1300-	        SUM(usagecount) as sum_usagecount,
postgresql.log.2025-10-11-1300-	        NULLIF(SUM(isdirty::int), 0) as sum_dirty,
postgresql.log.2025-10-11-1300-	        NULLIF(SUM(pinning_backends), 0) as sum_pinning
postgresql.log.2025-10-11-1300-	    FROM pg_buffercache
postgresql.log.2025-10-11-1300-	    GROUP BY reldatabase, relfilenode
postgresql.log.2025-10-11-1300-	)

Full Query

WITH buffer_by_relfilenode AS (
	    SELECT reldatabase, relfilenode,
	        NULLIF(COUNT(CASE WHEN relfilenode IS NOT NULL THEN 1 END), 0) as used,
	        COUNT(CASE WHEN relfilenode IS NULL THEN 1 END) as unused,
	        SUM(usagecount) as sum_usagecount,
	        NULLIF(SUM(isdirty::int), 0) as sum_dirty,
	        NULLIF(SUM(pinning_backends), 0) as sum_pinning
	    FROM pg_buffercache
	    GROUP BY reldatabase, relfilenode
	)
	SELECT COALESCE(d.datname, 'shared'), n.nspname, c.relname,
	       used, unused, sum_usagecount, sum_dirty, sum_pinning
	  FROM buffer_by_relfilenode b
	  LEFT JOIN pg_database d ON b.reldatabase = d.oid
	  LEFT JOIN pg_class c ON b.relfilenode = pg_relation_filenode(c.oid)
	  LEFT JOIN pg_namespace n ON n.oid = c.relnamespace;

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