db-worker-node logs the full DataScript DB for query input errors, producing multi-gigabyte log files
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in src/main/frontend/worker/db_worker_node.cljs at the :db-worker-node-invoke-failed logging call and inspect the /v1/import-db-binary error path for the same raw-error logging. Reproduce the malformed thread-api/q request against a disposable non-empty graph, then verify that logs retain status, code, message, and method without serializing the DataScript DB or graph contents.
Written by the indexing model from the issue text.
Description
What Happened?
On Logseq Desktop 2.0.1, a malformed thread-api/q request caused the graph-local db-worker-node-YYYYMMDD.log file to grow to 3,002,106,416 bytes in about one minute.
The query declared two inputs but supplied only the implicit database input:
[:find ?e
:in $ ?property
:where
[?e :block/title ?property]]
The worker correctly rejected the request with:
Too few inputs passed, expected: [$ ?property], got: 1
However, log-invoke-error! logged the complete exception object. DataScript includes the received DB value in the exception's :data :got field, so serializing that exception also serialized the graph schema and datoms.
Observed impact from one real log:
- Total file size: 3,002,106,416 bytes (2.8 GiB)
- Total lines: 894
- Oversized lines: 75
- Size of each oversized line: 40,024,609 bytes
- Total size of oversized lines: 3,001,845,675 bytes
- Time window: 2026-08-12T15:43:03.086Z to 2026-08-12T15:44:10.047Z
This is also a privacy concern because the log contains graph titles and datoms. I am therefore not attaching the original log.
The invalid query was issued repeatedly by a caller, which is a separate caller bug. Regardless of the caller, one rejected worker request should not write an entire graph to disk.
Reproduce the Bug
- Start
db-worker-nodefor a non-empty disposable DB graph with error logging enabled. - Invoke
thread-api/qwith a query that declares:in $ ?property, but supply only the query. - Inspect the graph-local
db-worker-node-YYYYMMDD.logfile. - Observe that the
:db-worker-node-invoke-failedentry contains#datascript/DB, including schema and datoms. - Repeat the request and observe that the log grows by roughly the serialized size of the graph each time.
Expected Behavior
The worker should retain useful diagnostics such as status, error code, message, and method, but it should not serialize the DataScript DB or graph contents into the log.
Desktop or Mobile Platform Information
- macOS Desktop
- Logseq 2.0.1
db-worker-noderevision reported by the log:b09316a- DB graph
Additional Context
The relevant path is src/main/frontend/worker/db_worker_node.cljs:
(log/error :db-worker-node-invoke-failed
{:status status
:code code
:error error
:message message
:method method-kw})
Removing the raw :error value prevents its ex-data from recursively serializing the database. The existing status, code, message, and method fields preserve the actionable request context. The /v1/import-db-binary error path contains the same raw-error logging and can use the shared sanitized helper as well.
The original caller could not be identified from the worker log, but the worker-side behavior is deterministic and reproducible in a disposable graph without the original caller or graph.
Are you willing to submit a PR?
- I'm willing to submit a PR.
- Dominant language
- No language data
- Stars
- 28
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from logseq/db-test
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenLiberty/open-liberty#35839 ·
-
affects-9.0 found-by-ai may-affects-25.10 may-affects-26.3 may-affects-26.9 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/execution type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
antlr/grammars-v4#5014 · 1 comment ·
-
comp-query-execution fuzz
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121303 · 3 comments ·