Skip to content

reference_sha256 broke my server. #3091

@matrixbot

Description

@matrixbot

This issue was originally created by @IngwiePhoenix at matrix-org/dendrite#3091.

Background information

  • Dendrite version or git SHA: 0.12.0+5d6221d1
  • SQLite3 or Postgres?: Postgres
  • Running in Docker?: No
  • go version: go version go1.19.3 linux/amd64
  • Client used (if applicable): Technically Element - but the server is down.

Description

  • What is the problem: After upgrading Dendrite, I noticed that the server wasn't coming back online. It turns out that one of the migrations is not, or can not, be applied. I even tried to reset to a few commits earlier, but the problem persists.
  • Who is affected: Me, I use Dendrite mainly as an old-fashioned "everything messenger" with appservices and bridges.
  • How is this bug manifesting: Immediately on startup
  • When did this first appear: Today after git pull.

This is what journalctl shows me.

May 28 14:58:49 birb.it dendrite[40838]: time="2023-05-28T19:58:49.475696978Z" level=info msg="Dendrite version 0.12.0+5d6221d1"
May 28 14:58:49 birb.it dendrite[40838]: time="2023-05-28T19:58:49.477771180Z" level=info msg="DNS cache enabled (size 256, lifetime 5m0s)"
May 28 14:58:49 birb.it dendrite[40838]: time="2023-05-28T19:58:49.515920674Z" level=panic msg="failed to connect to room server db" error="Error \"pq: column \\\"reference_sha256\\\" of relation \\\"roomserver_events\\\" does not exist\" while preparing statement: INSERT INTO roomserver_events AS e (room_nid, event_type_nid, event_state_key_nid, event_id, reference_sha256, auth_event_nids, depth, is_rejected) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT ON CONSTRAINT roomserver_event_id_unique DO UPDATE SET is_rejected = $8 WHERE e.event_id = $4 AND e.is_rejected = TRUE RETURNING event_nid, state_snapshot_nid"
May 28 14:58:49 birb.it dendrite[40838]: panic: (*logrus.Entry) 0xc000222230
May 28 14:58:49 birb.it dendrite[40838]: goroutine 1 [running]:
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).log(0xc0002221c0, 0x0, {0xc00004a390, 0x23})
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:260 +0x4a7
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).Log(0xc0002221c0, 0x0, {0xc0000e9358?, 0xc0000e93b8?, 0x4615c9?})
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:304 +0x4f
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).Panic(...)
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:342
May 28 14:58:49 birb.it dendrite[40838]: github.com/MFAshby/stdemuxerhook.(*StdDemuxerHook).Fire(0x0?, 0xc0002220e0)
May 28 14:58:49 birb.it dendrite[40838]:         github.com/MFAshby/[email protected]/stdemuxerhook.go:58 +0x19e
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.LevelHooks.Fire(0xc0000e9498?, 0xe9468?, 0x4?)
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/hooks.go:28 +0x82
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).fireHooks(0xc0002220e0)
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:280 +0x1dc
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).log(0xc000222070, 0x0, {0xc00004a360, 0x23})
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:242 +0x390
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).Log(0xc000222070, 0x0, {0xc0000e9758?, 0x0?, 0x0?})
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:304 +0x4f
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).Logf(0xc000222070, 0x0, {0x176d95a?, 0x151e560?}, {0x0?, 0x5a?, 0x5?})
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:349 +0x85
May 28 14:58:49 birb.it dendrite[40838]: github.com/sirupsen/logrus.(*Entry).Panicf(...)
May 28 14:58:49 birb.it dendrite[40838]:         github.com/sirupsen/[email protected]/entry.go:387
May 28 14:58:49 birb.it dendrite[40838]: github.com/matrix-org/dendrite/roomserver.NewInternalAPI(0xc000277950, 0xc000347c00, {0x0, {0x0, 0x0}, {{0xc00015bc80, 0x3d}, 0x5a, 0x5, 0xffffffffffffffff}, ...}, ...)
May 28 14:58:49 birb.it dendrite[40838]:         github.com/matrix-org/dendrite/roomserver/roomserver.go:41 +0x145
May 28 14:58:49 birb.it dendrite[40838]: main.main()
May 28 14:58:49 birb.it dendrite[40838]:         github.com/matrix-org/dendrite/cmd/dendrite/main.go:152 +0xc25
May 28 14:58:49 birb.it systemd[1]: matrix-dendrite.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
May 28 14:58:49 birb.it systemd[1]: matrix-dendrite.service: Failed with result 'exit-code'.

Steps to reproduce

Because I haven't found a solid way to update only to specific tags, I have been pulling from master since a long time now instead. Usually when I felt like it - no fixed schedule. After that, I'd just run ./build.sh to have all the binaries built and I have a SystemD unit pointing at it.

The SystemD unit:

# /opt/systemd-units/matrix-dendrite.service
[Unit]
Description=Dendrite (Matrix Homeserver)
After=syslog.target
After=network.target
After=postgresql.service

[Service]
#Environment=GODEBUG=madvdontneed=1
#Environment="PPROFLISTEN=localhost:65432"
RestartSec=2s
Type=simple
User=dendrite
Group=dendrite
WorkingDirectory=/srv/matrix-dendrite/
ExecStart=/opt/matrix-dendrite/bin/dendrite -config /srv/matrix-dendrite/dendrite.yaml
Restart=always
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

I have always done the exact order of commands:

git pull
./build.sh
systemctl restart matrix-dendrite

So it should have ran migrations - but maybe I somehow mised one?

Thanks and kind regards,
Ingwie

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions