Skip to content

aurora_analytics 1.0.0: foreign-table query aborts in libduckdb ("pure virtual method called") and restarts the Aurora PostgreSQL 18.6 instance

0

We are trying out the new direct querying of Apache Iceberg data from Aurora PostgreSQL (aurora_analytics extension). One read-only query against a foreign table aborted the backend inside libduckdb.so. Because a backend died abnormally, the postmaster terminated every process and the DB instance restarted, so all its connections dropped for about 20 seconds. Any login that can SELECT the foreign table can apparently restart the instance it runs on, which matters to us because our readers also serve application traffic.

Environment

  • Aurora PostgreSQL 18.6 (aurora_version() = 18.6.0), Serverless v2 (db.serverless), reader instance, us-east-2
  • aurora_analytics 1.0.0; aurora_analytics.enabled = 1 in the cluster parameter group; IAM role attached with the AuroraAnalytics feature
  • Foreign table on aurora_analytics_server with an explicit 46-column list (two map columns and one list column declared json), location = the Glue Data Catalog table ARN. Two plain views on top of it (SELECT * FROM <foreign table>, one with a WHERE filter).
  • Source: Glue Data Catalog Iceberg v2 table, unpartitioned, Parquet (zstd), SSE-KMS bucket, about 24 MB and 950k rows. A Glue Spark job appends to it hourly.
  • Glue managed compaction (binpack) was enabled the same day. About 2 hours 20 minutes before the crash it rewrote the table from 4,576 files to 2, and the hourly append had created a new snapshot 10 minutes before the crash.

What ran (UTC)

One connection, as a non-superuser login with SELECT on the foreign table and views:

  1. A few ordinary catalog and table queries (all succeeded)
  2. SELECT enum_range(NULL::"SomeMissingType"); → ERROR: type does not exist
  3. CREATE TEMP TABLE t (x int); ... → ERROR: cannot execute CREATE TABLE in a read-only transaction
  4. At 21:11:58: SELECT date FROM my_schema.events_view WHERE date = to_char(current_date - 1, 'YYYY-MM-DD') LIMIT 1;

At 21:12:00 the backend aborted; the RDS event "DB instance restarted" followed at 21:12:22.

PostgreSQL log

pure virtual method called
pure virtual method called

** Unhandled Exception with NULL exception_ptr
 Stack trace:
	/rdsdbbin/aurora/lib/libstdc++.so.6 [0x400023a7d1b0]
	/rdsdbbin/aurora/lib/libstdc++.so.6 [0x400023a7e380]
	/rdsdbbin/aurora/lib/libduckdb.so [0x400700f0f260]
	/rdsdbbin/aurora/lib/libduckdb.so [0x400700ee6380]
	/rdsdbbin/aurora/lib/libduckdb.so [0x400700ee7568]
	/rdsdbbin/aurora/lib/libduckdb.so [0x400700ee799c]
	/lib64/libpthread.so.0 [0x4000238fcb8c]
	/rdsdbbin/aurora/lib/libduckdb.so [0x400700edf928]
	/rdsdbbin/aurora/lib/libduckdb.so [0x400700f0d1ac]
	/rdsdbbin/aurora/lib/libstdc++.so.6 [0x400023ab63bc]
	/lib64/libpthread.so.0 [0x4000238f422c]
	/lib64/libc.so.6 [0x4000257d36dc]
LOG:  client backend (PID 95664) was terminated by signal 6: Aborted
DETAIL:  Failed process was running: SELECT date FROM my_schema.events_view WHERE date = to_char(current_date - 1, 'YYYY-MM-DD') LIMIT 1;
LOG:  terminating any other active server processes
FATAL:  Aurora Runtime process unexpectedly exited
LOG:  database system is shut down

Could not reproduce (23 attempts, same instance after the restart)

  • The same statement on fresh connections, 3 times
  • SELECT date FROM my_schema.events_view LIMIT 1, 3 times
  • The full statement sequence above, including both failing statements
  • One connection running 15 LIMIT scans interleaved with failing statements and aggregates
  • 66 aggregate queries over the foreign table and views

The crashing frames run on a worker thread, which suggests a race with an object that was already destroyed. Our guesses are an early scan termination by LIMIT, or cache or metadata state left over after compaction replaced the table's data files and a new snapshot landed. Every reproduction attempt ran right after the restart, with an empty cache, so the second condition was never recreated.

Questions

  1. Is this a known issue in aurora_analytics 1.0.0, and is a fix planned?
  2. Can a failure in the embedded engine be contained to the session instead of restarting the whole instance?
  3. Until it is fixed, are there query shapes or settings to avoid? For example LIMIT directly on a foreign scan, aurora_analytics.query_mem, or querying shortly after the source table's files are rewritten.

Happy to share more detail with the Aurora team privately.

2 Answers
0

The feature launched around 2026-09-29 — roughly a week before your crash. You're on day-one software, and that shapes the realistic answers to all three questions.

Q1: Not a documented known issue

The user guide covers foreign table syntax, permissions, and a handful of limitations (no case-differing column names, no planner statistics, metadata-only ALTERs), but nothing resembling this. At 1.0.0 with this little field exposure, the absence of a published issue tells you almost nothing — it's more likely nobody has reported it yet than that it's unknown-to-be-broken.

Your diagnosis reads correctly to me. "Pure virtual method called" plus std::terminate with a null exception_ptr, on a worker thread, is the signature of a virtual dispatch through an object already partway through destruction. Combined with the timeline — 4,576 files collapsed to 2, then a fresh snapshot ten minutes before — stale cached metadata pointing at objects torn down underneath a running scan is a coherent story. The announcement explicitly lists caching among the optimisations, which is where that state would live.

Q2: Containment isn't something you can configure

The instance restart isn't Aurora being conservative — it's standard PostgreSQL. A backend terminated by a signal leaves shared memory in an unknown state, so the postmaster kills every other backend and reinitialises. There's no setting that makes an abnormally-terminated backend survivable.

So containment has to happen before the abort. For an embedded C++ engine that means catching at the extension boundary and raising a PostgreSQL ERROR instead. The hard part is that std::terminate from a worker thread calls abort() directly — it can't be caught by normal exception handling, only by a terminate handler installed by the extension. That's a fix in aurora_analytics, not a knob for you.

Worth stating plainly in your report: embedding a multi-threaded engine inside a PostgreSQL backend means any unhandled worker-thread condition is a cluster-instance restart. That's structural, not incidental to this one bug, and it's the strongest argument for AWS to harden the boundary rather than just fix the specific race.

Q3: What to do now

Isolate analytics onto readers that serve nothing else. This is the highest-value mitigation and you can do it today. Your log shows "DB instance restarted" — the blast radius is one instance. Put analytics traffic on a dedicated reader behind a custom endpoint, and an abort costs you that instance's connections rather than application traffic.

Check whether aurora_analytics.enabled is instance-modifiable. You have it set in the cluster parameter group. If it can be overridden to 0 in a DB (instance-level) parameter group, disabling it on application-serving readers removes the attack surface from those instances entirely. Worth testing — it would make the isolation above enforceable rather than conventional.

Separate compaction from query windows. Glue managed compaction was enabled the same day, and the rewrite preceded the crash by 2h20m with a new snapshot 10 minutes before. Until this is understood, scheduling compaction into a window where analytics queries are quiesced is cheap insurance. If managed compaction can't be scheduled, consider running it manually.

Treat LIMIT on a foreign scan as suspect. Your early-termination hypothesis is plausible — a scan torn down before completion while worker threads are still live is a classic shape for this. Low cost to avoid pending a fix.

On reproduction

Your 23 attempts all began with a cold cache after the restart, which is precisely why none reproduced. The state you need isn't the query, it's the cache:

  1. Query the foreign table so metadata is cached against the current file layout
  2. Trigger compaction so those files are rewritten out from under it
  3. Append to create a new snapshot
  4. Query again on the same connection

That's the sequence your crash actually followed. Doing it deliberately on a throwaway cluster is the thing most likely to turn this into something AWS can fix quickly.

EXPERT

answered a month ago

0

The important part here is that this isn't a normal PostgreSQL query error. The backend running the foreign-table query terminated with SIGABRT inside libduckdb.so, followed by terminating any other active server processes and Aurora Runtime process unexpectedly exited.

Given that, I don't think changing SQL permissions or retrying different query shapes will identify the root cause. The earlier enum_range and read-only transaction errors also look like normal PostgreSQL errors, and without more evidence I wouldn't connect them to the later crash.

Since the query doesn't reproduce after the restart, I'd preserve the exact timestamp, PostgreSQL log, RDS event, query text, Aurora version, aurora_analytics version, and the Iceberg snapshot and compaction history around the failure, then open an AWS Support case. AWS can correlate that with Aurora's internal crash telemetry and symbolicate the libduckdb.so stack, which isn't possible from the customer side.

I also wouldn't assume yet that avoiding LIMIT, tuning query_mem, or timing around compaction is the workaround. Those details are useful for reproducing the issue, but the stack trace alone doesn't show which one triggered the abort.

In the meantime, if the blast radius is the main concern, routing these foreign-table queries to a dedicated reader, potentially through a custom endpoint, could help isolate the analytics workload from the readers serving application traffic.

answered a month ago

EXPERT

reviewed 5 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.