RocketChat / RocketChat/Rocket.Chat

3.17.0: Assertion `task && "When an ares socket is closed we should have a handle for it"' failed.

Open
#22,841 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

Our staging server (13 users, ~2 active) crashed for no apparent reason shortly after a user sync script ran (the script runs every 5 minutes, ran fine before and after manual restart of RC, and changed/POSTed nothing in this run.) After manual restart it works fine.

(Crash behaviour is similar to #22062, also reported by myself, but the error message is different.)

Steps to reproduce:
  1. (Unclear)
  2. Server dies with the log entries posted below
  3. We had to manually restart RC.
Expected behavior:

Run, RC, keep on running! 😇 (Or at least attempt to restart, which could be achieved by systemd's Restart option. Since the systemd unit is created by rocketchatctl, I guess I'll file an issue there, too.)

Actual behavior:

systemd service exited, see logs below.

Server Setup Information:
  • Version of Rocket.Chat Server: 3.17.0 (Commit Hash: d4ce52e098, Commit Branch: HEAD)
  • Operating System: Debian GNU/Linux 9.13 (stretch)
  • Deployment Method: rocketchatctl
  • Number of Running Instances: 2 (one on this staging VM, one on a separate production VM)
  • DB Replicaset Oplog: the startup log says "Enabled"
  • NodeJS Version: v12.18.4 - x64
  • MongoDB Version: 4.0.19 (mmapv1)
Client Setup Information
  • Desktop App or Browser Version: n/a (no GUI client involved)
  • Operating System: n/a
Additional context

What's (maybe) special about our setup is that:

  • it's behind a corporate proxy (or more precisely, two different proxies, for HTTP and HTTPS) and not reachable from the outside world, which caused and causes a couple of problems (f.e. traefik can't request a LetsEncrypt certificate and creates an invalid "[0-9a-f.].traefik.default" cert)
  • the machine has both IPv6 and IPv4 addresses, not all of them connected to the Internet, which caused (and might cause) a couple of problems (see f.e. https://github.com/RocketChat/install.sh/issues/41)
Relevant logs:
(last log entry, 8 seconds before the error:)
rocketchat[1678]: API ➔ debug POST: /api/v1/logout

rocketchat[1678]: /usr/local/bin/node[1678]: ../src/cares_wrap.cc:361:void node::cares_wrap::{anonymous}::ares_sockstate_cb(void*, ares_socket_t, int, int): Assertion `task && "When an ares socket is closed we should have a handle for it"' failed.
rocketchat[1678]:  1: 0xa093f0 node::Abort() [/usr/local/bin/node]
rocketchat[1678]:  2: 0xa0946e  [/usr/local/bin/node]
rocketchat[1678]:  3: 0x98e81a  [/usr/local/bin/node]
rocketchat[1678]:  4: 0x185d901 ares__close_sockets [/usr/local/bin/node]
rocketchat[1678]:  5: 0x186649e  [/usr/local/bin/node]
rocketchat[1678]:  6: 0x18668df  [/usr/local/bin/node]
rocketchat[1678]:  7: 0x1866ad5  [/usr/local/bin/node]
rocketchat[1678]:  8: 0x1348228  [/usr/local/bin/node]
rocketchat[1678]:  9: 0x1335e4f uv_run [/usr/local/bin/node]
rocketchat[1678]: 10: 0xa4b665 node::NodeMainInstance::Run() [/usr/local/bin/node]
rocketchat[1678]: 11: 0x9da5a8 node::Start(int, char**) [/usr/local/bin/node]
rocketchat[1678]: 12: 0x7f6b0d8d92e1 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
rocketchat[1678]: 13: 0x979215  [/usr/local/bin/node]
traefik[869]: time="2021-08-03T09:18:11Z" level=error msg="vulcand/oxy/forward/websocket: Error when copying from backend to client: websocket: close 1006 (abnormal closure): unexpected EOF"
traefik[869]: time="2021-08-03T09:18:11Z" level=error msg="vulcand/oxy/forward/websocket: Error when copying from backend to client: websocket: close 1006 (abnormal closure): unexpected EOF"
systemd[1]: rocketchat.service: Main process exited, code=killed, status=6/ABRT
systemd[1]: rocketchat.service: Unit entered failed state.
systemd[1]: rocketchat.service: Failed with result 'signal'.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported Node.js v12.18.4 assertion in ../src/cares_wrap.cc and the accompanying systemd, Traefik, proxy, and IPv4/IPv6 setup details. Investigate whether the logout or user-sync activity can reproduce the ares socket failure under this deployment. Done means identifying a reproducible cause and confirming that the Rocket.Chat service no longer aborts unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.