Element desktop error message with the Element application logo on top.

Fix Element Desktop Error Connection reset by peer

  • Adam Douglas

Last week I ran system updates for Arch Linux as I normally do. Everything seemed okay, until I ran Element desktop (Matrix client). Each time I would run Element, it would crash shortly after. Further investigation was required to figure out what was going on. In the end I discovered this problem has been an ongoing since Sep 19, 2022, which is not ideal. Let’s take at what I’ve found to work around this bug until it has been resolved.

Environment

Problem

The application crashes shortly after being started.

I was not able to find anything when launching Element from the command line or launching with “–enable-logging” argument. However, I did end up receiving an error message when monitoring with journalctl.

$ journalctl -f
Apr 12 15:22:07 adamsdesk kernel: traps: ThreadPoolForeg[57565] trap int3 ip:5648e7635924 sp:7f3964c36050 error:0 in electron[5648e400e000+7267000]
Apr 12 15:22:07 adamsdesk systemd[1]: Started Process Core Dump (PID 57667/UID 0).
Apr 12 15:22:09 adamsdesk systemd-coredump[57668]: [🡕] Process 57467 (electron) of user 1000 dumped core.

                                                   Stack trace of thread 57565:
                                                   #0  0x00005648e7635924 n/a (electron + 0x5286924)
                                                   #1  0x00005648e423202b n/a (electron + 0x1e8302b)
                                                   #2  0x00005648e7544565 n/a (electron + 0x5195565)
                                                   #3  0x00007f39c74e1782 closedir (libc.so.6 + 0xcd782)
                                                   #4  0x00005648e752883c n/a (electron + 0x517983c)

.......... (truncated dump)

                                                   Stack trace of thread 57563:
                                                   #0  0x00007f39c7496766 n/a (libc.so.6 + 0x82766)
                                                   #1  0x00007f39c7499294 pthread_cond_timedwait (libc.so.6 + 0x85294)
                                                   #2  0x00005648e7534d2b n/a (electron + 0x5185d2b)
                                                   #3  0x00005648e75357b4 n/a (electron + 0x51867b4)
                                                   #4  0x00005648e750d448 n/a (electron + 0x515e448)
                                                   #5  0x00005648e750e08c n/a (electron + 0x515f08c)
                                                   #6  0x00005648e750dc7a n/a (electron + 0x515ec7a)
                                                   #7  0x00005648e750db12 n/a (electron + 0x515eb12)
                                                   #8  0x00005648e753898e n/a (electron + 0x518998e)
                                                   #9  0x00007f39c7499bb5 n/a (libc.so.6 + 0x85bb5)
                                                   #10 0x00007f39c751bd90 n/a (libc.so.6 + 0x107d90)
                                                   ELF object binary architecture: AMD x86-64
Apr 12 15:22:10 adamsdesk systemd[1]: systemd-coredump@1-57667-0.service: Deactivated successfully.
Apr 12 15:22:10 adamsdesk systemd[1]: systemd-coredump@1-57667-0.service: Consumed 2.095s CPU time.
Apr 12 15:22:10 adamsdesk io.element.Element.desktop[57532]: [57532:0412/152210.055595:ERROR:broker_posix.cc(40)] Recvmsg error: Connection reset by peer (104)

Solution - Workaround

Thanks to a posted project issue I learned of a workaround by disabling the feature “Message Search” which securely cache encrypted messages locally for them to appear in search results. Here are the steps I took.

Warning

Disabling this feature will result in being unable to search encrypted messages when using this application.

Note

These steps must be done quickly before the application crashes.

  1. Open Element Desktop application.
  2. Go to “Profile picture” > “All settings” > “Security and Privacy”
  3. Under “Message Search” click on the “Manage” button.
  4. Click on the “Disable” button.
  5. Confirm by clicking on the “Disable” button again.