Synchronization stopped working on Joplin Server v3.0.1

Operating system

Linux

Joplin version

3.2.12

Sync target

Joplin Server

What issue do you have?

I did set up Joplin server running in Docker. It worked fine for couple of days. Today I started hitting an error on both my MacOS as well as Android clients:
"Completed: 28/01/2025 20:37 (29s)
Last error: Error: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly"

Notes are obvious not being synchronized.

In my docker-compose logs I can see:
2025-01-28 19:37:48: TaskService: Running #11 (Process shared items) (scheduled)...
app_1 | 19:37:48 0|app | 2025-01-28 19:37:48: TaskService: Completed #11 (Process shared items) in 9ms
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: [error] db: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly {
app_1 | 19:37:51 0|app | "$1": "XlZUh5Rd2stsxz9Zet45VX",
app_1 | 19:37:51 0|app | "$2": 1
app_1 | 19:37:51 0|app | }
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: [error] App: 89.239.24.143, 89.239.24.143 Error: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly
app_1 | 19:37:51 0|app | at Connection. (/home/joplin/packages/server/node_modules/pg/lib/client.js:132:73)
app_1 | 19:37:51 0|app | at Object.onceWrapper (node:events:631:28)
app_1 | 19:37:51 0|app | at Connection.emit (node:events:517:28)
app_1 | 19:37:51 0|app | at Socket. (/home/joplin/packages/server/node_modules/pg/lib/connection.js:63:12)
app_1 | 19:37:51 0|app | at Socket.emit (node:events:517:28)
app_1 | 19:37:51 0|app | at TCP. (node:net:350:12)
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: App: GET /api/items/root:/:/delta (500) (564ms)
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: [error] db: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly {
app_1 | 19:37:51 0|app | "$1": "jMvQqngTQ6cAWxOkxAtqoH",
app_1 | 19:37:51 0|app | "$2": 1
app_1 | 19:37:51 0|app | }
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: [error] db: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly {
app_1 | 19:37:51 0|app | "$1": "wOc5fCqavQKjGaVTqRPSYR",
app_1 | 19:37:51 0|app | "$2": 1
app_1 | 19:37:51 0|app | }
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: [error] db: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly {
app_1 | 19:37:51 0|app | "$1": "1a1obB71wsEGdLvPTLg8o9",
app_1 | 19:37:51 0|app | "$2": 1
app_1 | 19:37:51 0|app | }
app_1 | 19:37:51 0|app | Connection Error: Connection ended unexpectedly
app_1 | 19:37:51 0|app | 2025-01-28 19:37:51: [error] App: Middleware error on /api/items/root:/temp/timeCheck172984.txt:/content: error: the database system is in recovery mode
app_1 | 19:37:51 0|app | at Parser.parseErrorMessage (/home/joplin/packages/server/node_modules/pg-protocol/src/parser.ts:369:69)
app_1 | 19:37:51 0|app | at Parser.handlePacket (/home/joplin/packages/server/node_modules/pg-protocol/src/parser.ts:188:21)
app_1 | 19:37:51 0|app | at Parser.parse (/home/joplin/packages/server/node_modules/pg-protocol/src/parser.ts:103:30)
app_1 | 19:37:51 0|app | at Socket. (/home/joplin/packages/server/node_modules/pg-protocol/src/index.ts:7:48)
app_1 | 19:37:51 0|app | at Socket.emit (node:events:517:28)
app_1 | 19:37:51 0|app | at addChunk (node:internal/streams/readable:368:12)
app_1 | 19:37:51 0|app | at readableAddChunk (node:internal/streams/readable:341:9)
app_1 | 19:37:51 0|app | at Socket.Readable.push (node:internal/streams/readable:278:10)
app_1 | 19:37:51 0|app | at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
app_1 | 19:37:51 0|app | length: 109,
app_1 | 19:37:51 0|app | severity: 'FATAL',
app_1 | 19:37:51 0|app | code: '57P03',
app_1 | 19:37:51 0|app | detail: undefined,
app_1 | 19:37:51 0|app | hint: undefined,
app_1 | 19:37:51 0|app | position: undefined,
app_1 | 19:37:51 0|app | internalPosition: undefined,
app_1 | 19:37:51 0|app | internalQuery: undefined,
app_1 | 19:37:51 0|app | where: undefined,
app_1 | 19:37:51 0|app | schema: undefined,
app_1 | 19:37:51 0|app | table: undefined,
app_1 | 19:37:51 0|app | column: undefined,
app_1 | 19:37:51 0|app | dataType: undefined,
app_1 | 19:37:51 0|app | constraint: undefined,
app_1 | 19:37:51 0|app | file: 'postmaster.c',
app_1 | 19:37:51 0|app | line: '2356',
app_1 | 19:37:51 0|app | routine: 'ProcessStartupPacket'
app_1 | 19:37:51 0|app | }

I have the same issue.

Application says:
Fetched items: 100/100.
Completed: 24.02.2025 11:31 (72s)
Last error: Error: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly

debug mode:
Synchronizer: Details: GET api/items/root:/:/delta: select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly (500): {"error":"select "content" from "items" where "id" = $1 limit $2 - Connection terminated unexpectedly"}

Server same logs as already mentioned

Try restarting the postgres db and possibly increasing the allocated memory as well. This post suggests you get the error "the database system is in recovery mode" when the database has crashed postgresql - SQLSTATE[08006] [7] FATAL: the database system is in recovery mode - Database Administrators Stack Exchange

Yes it sounds like a database issue so also check the Postgres log. Also if the issue is the size of the data, you may consider setting up the storage differently, for example saving the content to the filesystem instead:

https://github.com/laurent22/joplin/tree/dev/packages/server#setup-storage

For example here, how large is the content? If you run select id, content_size from "items" where "id" = "XlZUh5Rd2stsxz9Zet45VX" limit 1 directly on the database you can check this

Apologies for the late reply, my notifications where not set up correctly yet.
Thanks for the help, I indeed had some CPU and mem restrictions, removed those and everything started working again. Will further monitor.

Thanks!

Wesley

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.