matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.67k stars 664 forks source link

Crash on OpenBSD #2051

Closed martenlindblad closed 2 years ago

martenlindblad commented 2 years ago

Version: 0.5.0 DB: PostgreSQL 13.4 on x86_64-unknown-openbsd7.0, compiled by OpenBSD clang version 11.1.0, 64-bit Dendrite died and these are the last messages from the server log.

time="2021-11-19T07:25:46.542097092Z" level=info msg="Sending cross-signing update message to [\"matrix.org\" \"envs.net\" \"halogen.city\" \"bau-ha.us\" \"nil.im\" \"feneas.org\" \"kde.org\" \"matrix.nice.sampler.fi\" \"cavalca.name\" \"chat.uq.edu.au\" \"sexylo.li\" \"alarum.de\" \"disbish.com\" \"exploit.pub\" \"freitrix.de\" \"reactos.org\" \"ggc-project.de\" \"nitro.chat\" \"mozilla.org\" \"tchncs.de\" \"cyberia.club\" \"zstream.se\"]" func="github.com/matrix-org/dendrite/federationsender/consumers.(*KeyChangeConsumer).onCrossSigningMessage" file="github.com/matrix-org/dendrite/federationsender/consumers/keychange.go:189" user_id="@m:zstream.se"
time="2021-11-19T07:25:46.542178538Z" level=info msg="Sending EDU event" func="github.com/matrix-org/dendrite/federationsender/queue.(*OutgoingQueues).SendEDU" file="github.com/matrix-org/dendrite/federationsender/queue/queue.go:310" destinations=21 edu_type=m.signing_key_update
time="2021-11-19T07:25:46.584776701Z" level=error msg="Failed to get pending PDUs for \"nil.im\"" func="github.com/matrix-org/dendrite/federationsender/queue.(*destinationQueue).getPendingFromDatabase" file="github.com/matrix-org/dendrite/federationsender/queue/destinationqueue.go:208" error="sqlutil.WithTransaction.Begin: pq: remaining connection slots are reserved for non-replication superuser connections"
time="2021-11-19T07:25:46.595076845Z" level=info msg="Producing to topic 'DendriteOutputSendToDeviceEvent'" func="github.com/matrix-org/dendrite/eduserver/input.(*EDUServerInputAPI).sendToDeviceEvent" file="github.com/matrix-org/dendrite/eduserver/input/input.go:182" num_devices=1 type=m.key.verification.done user_id="
@m:zstream.se"
time="2021-11-19T07:25:46.622687184Z" level=error msg="Failed to get pending PDUs for \"alarum.de\"" func="github.com/matrix-org/dendrite/federationsender/queue.(*destinationQueue).getPendingFromDatabase" file="github.com/matrix-org/dendrite/federationsender/queue/destinationqueue.go:208" error="sqlutil.WithTransaction.Begin: pq: remaining connection slots are reserved for non-replication superuser connections"
time="2021-11-19T07:25:46.634761481Z" level=info msg="Sending send-to-device message into \"zstream.se\" destination queue" func="github.com/matrix-org/dendrite/federationsender/consumers.(*OutputEDUConsumer).onSendToDeviceEvent" file="github.com/matrix-org/dendrite/federationsender/consumers/eduserver.go:149"
time="2021-11-19T07:25:46.638852522Z" level=info msg="sync API received send-to-device event from EDU server" func="github.com/matrix-org/dendrite/syncapi/consumers.(*OutputSendToDeviceEventConsumer).onMessage" file="github.com/matrix-org/dendrite/syncapi/consumers/eduserver_sendtodevice.go:104" context=missing device_id=HkvyyuWE event_type=m.key.verification.done sender="@m:zstream.se" user_id="@m:zstream.se"
time="2021-11-19T07:25:46.685259834Z" level=info msg="Producing to topic 'DendriteOutputSendToDeviceEvent'" func="github.com/matrix-org/dendrite/eduserver/input.(*EDUServerInputAPI).sendToDeviceEvent" file="github.com/matrix-org/dendrite/eduserver/input/input.go:182" num_devices=1 type=m.key.verification.done user_id="@m:zstream.se"
martenlindblad commented 2 years ago

Solved by adding to /etc/sysctl.conf

kern.seminfo.semmni=60
kern.seminfo.semmns=1024

In /var/postgresql/data/postgresql.conf add this:

max_connections = 30
shared_buffers = 256MB