Troubleshooting
This page lists the problems people hit most often, what each one means, and what to do. Start-up problems come first, then connection problems, then errors returned by statements, listed by SQLSTATE.
When the cause is not obvious, restart with --log-level info (or debug) and read standard error; see Running the server.
The server does not start
When the server refuses to start it prints the reason to standard error and exits with status 2.
--location <PATH> is required
error: --location <PATH> is required unless --in-memory or --restore-to is givenGive the data directory with --location, or run --in-memory for a throwaway database.
The data directory is already open
could not open the database catalogue: /var/lib/rasterizeddb is already open in another RasterizedDB (process 4182, or an earlier engine in that process): ...Another server process has this data directory. Only one may: two would corrupt it. Stop the other process (the message names its process id), or give this one another directory. The lock belongs to the operating system and disappears with the process, so there is no stale lock file to delete after a crash. See The data-directory lock.
The CPU lacks AVX2
this build of RasterizedDB requires an x86-64-v3 CPU (AVX2, BMI1/2, FMA, LZCNT, MOVBE); this CPU (...) lacks: ...The x86-64 builds need an x86-64-v3 CPU (Intel Haswell, AMD Excavator or later). On a virtual machine, set the CPU model to pass the host's features through (for example "host" in QEMU/KVM or Proxmox). There is no release build for older CPUs. See Install.
--simd avx512 (or avx2) on a CPU that lacks it also refuses to start; leave --simd at auto.
Refusing to serve the native protocol with authentication off
refusing to serve the native protocol on 0.0.0.0:61170 with authentication off: anyone who can reach that address would have unauthenticated access. Set --rdb-password (or create a role with one), or bind loopback.The native listener was asked to listen on a network address, but no password is configured and no role has one. Set RASTERIZEDDB_PG_PASSWORD (with --protocol both) or RASTERIZEDDB_PASSWORD (with --protocol rastcp) for the first start. In Docker this is the error when RASTERIZEDDB_PG_PASSWORD is missing.
A port is in use
The listener that could not bind is named in the message. Another program, or another RasterizedDB, is on that port. Change it (--pg-port, --rdb-port, --replication-port…) or stop the other program. Two servers on one host also need different --replication-port values, since its default (61171) does not follow --rdb-port.
A flag is refused
Every flag is checked before any listener starts, and a bad one names itself, for example:
--pg-tcp off needs --pg-socket-dir: there would be nothing to connect to
unknown --pg-auth "kerberos": expected trust, password, md5 or scram-sha-256
--pg-auth peer is not offered: over TCP the user would be the caller's word. Peer authentication is for the unix socket: --pg-socket-auth peerCheck the flag against Configuration. rasterizeddb --help lists what this build accepts; a flag from a Cargo feature the build lacks is not there.
The directory uses features this build does not support
it uses on-disk features this binary does not support: ... use a build that supports themThe data directory was written by a newer server, or by a build with a Cargo feature this one lacks. Run the version (and features) that wrote it, or restore a backup taken before the upgrade. See Downgrading.
Backups could not start
could not start backups: ...With --s3-bucket set, the server will not start without its backups. The rest of the message says why: credentials, endpoint, bucket name, or a prefix that holds another database's backups. Fix the setting; if the bucket is merely unreachable and the database must come up anyway, add --s3-start-offline. See Backup and restore.
A damaged write-ahead log
WAL ... is damaged at byte ...: the bytes there are not a whole record, and ... whole records follow from byte ... (... committed transactions, commit sequences ... to ...)A torn record at the very end of the log is a crash and is replayed past silently. Whole records after a bad one mean damage, and the server refuses to guess. Copy the data directory first. Then either restore from a backup, or start once with --wal-truncate-damaged, which keeps the records before the damage and drops everything after it, and check the result.
Few open files
descriptors: the hard limit 4096 caps the soft limit below the 43008 that 4096 open partitions need, so at most ... stay open; raise the hard limit (LimitNOFILE= in the unit, or ulimit -Hn) to at least 43008Not an error: the server starts, but keeps fewer partitions open and, if the limit is low enough, lowers --max-connections with a warning. Raise the hard limit with LimitNOFILE= in the systemd unit or ulimit -Hn in the shell that starts it.
Clients cannot connect
Connection refused on port 5432
The PostgreSQL protocol is off by default: --protocol defaults to rastcp, the native protocol only. Start the server with --protocol both (or pgwire).
If the server runs on another machine, its listeners bind 127.0.0.1 by default; add --pg-addr 0.0.0.0 (and --rdb-addr 0.0.0.0 for the native protocol), and open the port in the firewall. In Docker, publish the port with -p 5432:5432.
TLS is required
FATAL: TLS is required (send SSLRequest / use sslmode=require)SQLSTATE 08004. The client connected without TLS, and --pg-tls require (the default) refuses cleartext. Use sslmode=require in the client, or start the server with --pg-tls prefer to accept both.
Certificate verification fails
The server's certificate is self-signed and made anew at every start unless you give it one, so a client that verifies (sslmode=verify-ca or verify-full, JDBC with sslmode=verify-full, node-postgres with rejectUnauthorized left on, Npgsql before version 8 without Trust Server Certificate=true) rejects it. Either encrypt without verifying (sslmode=require), or start the server with a certificate the client trusts (--pg-cert, --pg-key). With libpq, sslmode=require also verifies if ~/.postgresql/root.crt exists. See Connecting.
password authentication failed
SQLSTATE 28P01. The password is wrong, or the role has none. Remember that:
- roles are per database: the role must exist in the database the connection names;
- the bootstrap password is read only when a database's roles are first created; changing
RASTERIZEDDB_PG_PASSWORDlater changes nothing — useALTER ROLE … PASSWORD; - under
--pg-auth md5, a role must have had its password set while the server ran withmd5.
SQLSTATE 28000 means the role does not exist in that database or is not allowed to log in. See Security.
database "…" does not exist
SQLSTATE 3D000. The connection named a database the server does not have. The server never substitutes another database. Check SHOW DATABASES, and the database part of the connection string (/postgres in a URL, dbname=, Database=). See Databases.
sorry, too many clients already
SQLSTATE 53300. The server already has --max-connections PostgreSQL sessions (500 by default). Close idle connections, use a connection pool, or raise --max-connections. If the open-file limit is too low for the number you set, the server lowers it at start and says so.
canceling authentication due to timeout
SQLSTATE 57014 at connect. The client took longer than --authentication-timeout (60 seconds) to finish TLS and log in. Usually a network or client problem; raise the flag if logins are slow for a reason.
The connection is closed while idle
25P03: the session was idle inside a transaction longer thanidle_in_transaction_session_timeout, and its transaction was rolled back.57P05: the session was idle longer thanidle_session_timeout.57P01,terminating connection due to administrator command: the server is shutting down.
Over the native protocol, a connection idle longer than --rdb-request-timeout (30 seconds) is closed by the server.
Errors from statements
40001: could not serialize access due to concurrent update
Another transaction changed the same row first. The statement failed and its transaction cannot commit: roll it back and retry the whole transaction, from BEGIN. This is a normal outcome of concurrent writes, not a fault, so applications that write concurrently should retry on 40001. Keep transactions short to make it rarer. See Transactions.
40P01: deadlock detected
Two transactions each wait for a lock the other holds, and one of them fails with this error. Roll it back and retry it. Taking locks (or updating rows) in the same order in every transaction prevents it.
25P02: current transaction is aborted
ERROR: current transaction is aborted, commands ignored until end of transaction blockAn earlier statement in this transaction failed. Every statement after it fails until you ROLLBACK (or ROLLBACK TO SAVEPOINT). Look for the first error, not this one.
55P03: lock not available
A lock_timeout ran out, or a NOWAIT lock was refused, because another transaction holds the lock. Retry later, or find the long transaction holding it with SHOW QUERIES.
57014: canceling statement
The statement was cancelled: by the client, by statement_timeout, or over the native protocol by --rdb-request-timeout (30 seconds by default). For long native-protocol statements (backups, imports, big reports) raise --rdb-request-timeout or SET statement_timeout in the session.
0A000: feature not supported
The statement uses SQL this server does not implement, or implements differently enough that it refuses rather than answer differently. The message says what. Rewrite the statement (the message often names the cast or form to use), and check PostgreSQL compatibility.
0A000 with cached plan must not change result type is different: a prepared statement's result columns changed (a table was altered) since the driver prepared it. pgjdbc, Npgsql and psycopg prepare again by themselves. For a driver that does not, set rdb.shape_change = rowdescription on its sessions; see Session settings.
42501: permission denied
The role lacks a privilege on the table, or ran an administration statement (CREATE DATABASE, SET CONFIG, BACKUP, STORAGE, role statements and the like) without being a superuser:
ERROR: permission denied: SET CONFIG requires superuserGrant the privilege, or run it as a superuser. See Security.
55006: the database is in use
DROP DATABASE refuses the default database, the database the session is connected to, and a database with other sessions. Connect to another database and close the other sessions first.
53100: disk full
The disk under the data directory is full, and writes fail. Free space or grow the disk: remove old files outside the database, add a storage location on another disk and move tables to it (Storage pools), or reclaim dead space in tables with a large reclaimable_bytes in SHOW TABLES (Maintenance). With S3 backup on and the bucket unreachable, the staged log can also fill the disk until --s3-staging-max-mb stops it.
Other common codes
| SQLSTATE | Meaning |
|---|---|
23505 | Duplicate key: a row with that primary key or unique value already exists. |
23503 | Foreign key violation: the referenced row is missing, or rows still refer to the one being deleted. |
23502 | A NOT NULL column was given no value. |
23514 | A CHECK constraint failed; the message names it. |
42P01 | No such table, in this database. |
42703 | No such column. |
42601 | Syntax error. |
22P02 | A value that does not parse as the column's type. |
25006 | A write in a read-only transaction. |
Limits
- There is no SQL view of the sessions running right now (
pg_stat_activity), so a blocking transaction is found throughSHOW QUERIESand the application. - A crash or
kill -9is safe but makes the next start slower: it replays the write-ahead log and rebuilds indexes.