Describe the bug
On dbt-fusion running in dbt platform, with BigQuery, elementary.on_run_end() hangs forever after an upload's INSERT has already succeeded. No error, no panic, no further log output — the process simply stops making progress until the orchestrator kills it (dbt platform cancels on a 10-minute inactivity timeout).
The hang is in upload_run_results(), isolated by controlled bisect. Crucially it happens after the insert completes: BigQuery's INFORMATION_SCHEMA.JOBS shows the INSERT into dbt_run_results reaching DONE in ~1s, and then the invocation issues no further query, ever. The next statement in the macro is the commit:
{# macros/utils/table_operations/insert_rows.sql:76-78 #}
{% if should_commit %}
...
{% do adapter.commit() %}
BigQuery has no interactive transactions, so on dbt-core this commit is effectively a no-op. In dbt platform on Fusion it appears to block indefinitely.
Important scoping: this does not reproduce on Fusion generally — see the matrix under Additional context. The same commit path completes on Fusion in GitHub Actions and on Fusion locally. dbt platform is the only variable that isolates the failure, so this may be a platform-runner issue rather than an Elementary one; filing here because Elementary's on_run_end is what issues the commit, and because the should_commit behaviour looks avoidable regardless.
To Reproduce
- Run a dbt command that produces Elementary uploads on dbt-fusion in dbt platform, against BigQuery — we hit it with both
dbt source freshness and dbt run.
- Let
on_run_end reach an upload that actually inserts rows (upload_run_results always does).
- The
INSERT succeeds in BigQuery, then the process stops producing output and never exits.
Isolated by adding one disable var at a time to dbt source freshness:
| vars |
result |
| (none) |
stalls → 10-min inactivity timeout |
disable_freshness_results: true |
stalls |
+ disable_dbt_invocation_autoupload: true |
stalls — identical 4-job trail in BigQuery |
+ disable_run_results: true |
succeeds, 56.65s |
That eliminates upload_dbt_invocation() and clean_elementary_temp_tables() (a no-op here — clean_elementary_test_tables is guarded by {% if test_table_relations %} and the cache is empty on a freshness run), and leaves upload_run_results().
Note the bisect does not clear or convict upload_source_freshness(): in every stalling run upload_run_results was also enabled, so it would have stalled regardless. upload_run_results and upload_source_freshness are the only two uploads that pass append=True, so both bypass the diff path and always insert-then-commit — which makes freshness a plausible second instance of the same problem, but we did not isolate it independently.
The artifact uploads ran to completion in the successful run:
Elementary: [dbt_groups] Artifacts did not change.
Elementary: Uploaded dbt artifacts.
============================ Execution Summary ============================
INFO Invocation ... freshness with 4 warnings for target prod [56.65s]
BigQuery job trail for a stalled invocation (INFORMATION_SCHEMA.JOBS_BY_PROJECT, filtered on the dbt_invocation_id label):
| created |
secs |
state |
statement_type |
destination |
| 19:42:39 |
2 |
DONE |
SELECT |
(freshness metadata) |
| 19:42:44 |
0 |
DONE |
SELECT |
(our own on-run-end hook) |
| 19:42:47 |
1 |
DONE |
SELECT |
dbt_artifacts_hashes |
| 19:43:02 |
1 |
DONE |
INSERT |
dbt_run_results |
Nothing after 19:43:02. The run was killed at the 10-minute mark.
Expected behavior
on_run_end completes, or fails with a clear error. Specifically, adapter.commit() should not be able to block the run indefinitely on a warehouse with no interactive transactions — skipping the commit when the adapter is non-transactional (or bounding it) would avoid this entirely, regardless of where the underlying blocking behaviour originates.
Screenshots
dbt platform run summary showing the step cancelled at exactly 10m after dbt deps and freshness analysis had both succeeded — can attach if useful.
Environment
- Elementary CLI (edr) version: not involved in the failing run (the failure is in the dbt package's
on_run_end; our edr report job runs separately on dbt-core and is unaffected)
- Elementary dbt package version: 0.25.1
- dbt version you're using: dbt-fusion 2.0.0-preview.205 in dbt platform (fails). Same project on dbt-core 1.12.0b2 / dbt-bigquery 1.11.3 in dbt platform completes
on_run_end in 66s.
- Data warehouse: BigQuery
- Infrastructure details: dbt platform (dbt Cloud) scheduled job, Fusion Stable release track, prod target. Project size: ~530 models, ~2,160 tests, 188 sources, 34 exposures.
columns_upload_strategy: none.
Additional context
Where it does and doesn't reproduce. Neither the Fusion build nor the target dataset isolates the failure — only the execution environment does:
| Context |
Engine |
Elementary schema |
Insert + commit exercised |
Result |
| dbt platform |
Fusion 2.0.0-preview.205 |
prod |
upload_run_results |
hangs |
| dbt platform |
dbt-core 1.12.0b2 |
prod |
all uploads |
completes, 66s |
| GitHub Actions |
Fusion 2.0.0-preview.202 |
prod |
artifacts delete_and_insert (which also calls adapter.commit(), delete_and_insert.sql:43) |
completes |
| Local (macOS) |
Fusion 2.0.0-preview.205 |
dev |
all uploads |
completes, 233s (vs 223s on dbt-core — within 5%) |
The GitHub Actions row is a full artifacts change path against the production Elementary schema — temp CTAS → INSERTs → DELETE FROM dbt_models → INSERT INTO dbt_models → DROP temps, all DONE — so a Fusion adapter.commit() after a real insert demonstrably completes outside dbt platform. The pure Jinja/upload work is likewise not pathological on Fusion (local row).
Would you be willing to contribute a fix for this issue?
Yes — happy to test a candidate fix against our project, where this reproduces reliably in dbt platform. Can attempt a PR if you can point at the preferred approach (skip the commit for non-transactional adapters vs. handle it in insert_rows).
Describe the bug
On dbt-fusion running in dbt platform, with BigQuery,
elementary.on_run_end()hangs forever after an upload'sINSERThas already succeeded. No error, no panic, no further log output — the process simply stops making progress until the orchestrator kills it (dbt platform cancels on a 10-minute inactivity timeout).The hang is in
upload_run_results(), isolated by controlled bisect. Crucially it happens after the insert completes: BigQuery'sINFORMATION_SCHEMA.JOBSshows theINSERTintodbt_run_resultsreachingDONEin ~1s, and then the invocation issues no further query, ever. The next statement in the macro is the commit:BigQuery has no interactive transactions, so on dbt-core this commit is effectively a no-op. In dbt platform on Fusion it appears to block indefinitely.
Important scoping: this does not reproduce on Fusion generally — see the matrix under Additional context. The same commit path completes on Fusion in GitHub Actions and on Fusion locally. dbt platform is the only variable that isolates the failure, so this may be a platform-runner issue rather than an Elementary one; filing here because Elementary's
on_run_endis what issues the commit, and because theshould_commitbehaviour looks avoidable regardless.To Reproduce
dbt source freshnessanddbt run.on_run_endreach an upload that actually inserts rows (upload_run_resultsalways does).INSERTsucceeds in BigQuery, then the process stops producing output and never exits.Isolated by adding one disable var at a time to
dbt source freshness:disable_freshness_results: true+ disable_dbt_invocation_autoupload: true+ disable_run_results: trueThat eliminates
upload_dbt_invocation()andclean_elementary_temp_tables()(a no-op here —clean_elementary_test_tablesis guarded by{% if test_table_relations %}and the cache is empty on a freshness run), and leavesupload_run_results().Note the bisect does not clear or convict
upload_source_freshness(): in every stalling runupload_run_resultswas also enabled, so it would have stalled regardless.upload_run_resultsandupload_source_freshnessare the only two uploads that passappend=True, so both bypass the diff path and always insert-then-commit — which makes freshness a plausible second instance of the same problem, but we did not isolate it independently.The artifact uploads ran to completion in the successful run:
BigQuery job trail for a stalled invocation (
INFORMATION_SCHEMA.JOBS_BY_PROJECT, filtered on thedbt_invocation_idlabel):dbt_artifacts_hashesdbt_run_resultsNothing after 19:43:02. The run was killed at the 10-minute mark.
Expected behavior
on_run_endcompletes, or fails with a clear error. Specifically,adapter.commit()should not be able to block the run indefinitely on a warehouse with no interactive transactions — skipping the commit when the adapter is non-transactional (or bounding it) would avoid this entirely, regardless of where the underlying blocking behaviour originates.Screenshots
dbt platform run summary showing the step cancelled at exactly 10m after
dbt depsand freshness analysis had both succeeded — can attach if useful.Environment
on_run_end; ouredr reportjob runs separately on dbt-core and is unaffected)on_run_endin 66s.columns_upload_strategy: none.Additional context
Where it does and doesn't reproduce. Neither the Fusion build nor the target dataset isolates the failure — only the execution environment does:
upload_run_resultsdelete_and_insert(which also callsadapter.commit(),delete_and_insert.sql:43)The GitHub Actions row is a full artifacts change path against the production Elementary schema — temp CTAS → INSERTs →
DELETE FROM dbt_models→INSERT INTO dbt_models→ DROP temps, allDONE— so a Fusionadapter.commit()after a real insert demonstrably completes outside dbt platform. The pure Jinja/upload work is likewise not pathological on Fusion (local row).INFORMATION_SCHEMA.JOBSon thedbt_invocation_idlabel rather than trusting the log tail.on_run_endafter successful uploads/inserts — same hook, same trigger point, different symptom, older Fusion preview 173 and Elementary 0.22.1). Also process_freshness_result crashes with "Failed to render SQL undefined value" on dbt-fusion #2245 (process_freshness_resulton dbt-fusion), which appears already guarded in 0.25.1.disable_freshness_resultsis easy to miss — it is not covered by the four listed together in the reduce on-run-end time guide, sodbt source freshnesskeeps uploading when you believe you've disabled everything. Happy to open that separately as a docs issue.Would you be willing to contribute a fix for this issue?
Yes — happy to test a candidate fix against our project, where this reproduces reliably in dbt platform. Can attempt a PR if you can point at the preferred approach (skip the commit for non-transactional adapters vs. handle it in
insert_rows).