Rocket.chat: [Bug][Federation] Request that loops

Created on 23 Sep 2020  Â·  10Comments  Â·  Source: RocketChat/Rocket.Chat

I hope you are well.

Description:

I am currently in version 3.4.2 of the official docker image ( rocketchat/rocket.chat ) , when I switch to 3.6.2 the migration is done correctly, but when I go to the federation dashboard the application crashes.

Steps to reproduce:

Go to Admin
Click on Federation Dashboard

Expected behavior:

See the dashboard

Actual behavior:

I noticed that a loop is created in the developer console with many call of :

/api/v1/method.call/federation%3AgetOverviewData && /api/v1/method.call/federation%3AgetServers

The application ends up crashing due to api limits.

Server Setup Information:

  • Version of Rocket.Chat Server: 3.6.2
  • Operating System: linux
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 12.16.1 - x64
  • MongoDB Version: 4.0

Client Setup Information

  • Desktop App or Browser Version: Chromium Version 85.0.4183.102 (Official Build) snap (64-bit)
  • Operating System: Ubuntu 20.04

Additional context

Relevant logs:

Exception while invoking method federation:getOverviewData Error: Error, too many requests. Please slow down. You must wait 27 seconds before trying again. [too-many-requests]
    at Object.post (app/api/server/v1/misc.js:255:11)
    at app/api/server/api.js:394:82
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
    at Object._internalRouteActionHandler [as action] (app/api/server/api.js:394:39)
    at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:150:32)
    at packages/nimble_restivus/lib/route.coffee:59:33
    at packages/simple_json-routes.js:98:9
API âž” debug Success {
  statusCode: 200,
  body: {
    message: '{"msg":"result","id":"3947","error":{"isClientSafe":true,"error":"too-many-requests","reason":"Error, too many requests. Please slow down. You must wait 27 seconds before trying again.","details":{"timeToReset":26564},"message":"Error, too many requests. Please slow down. You must wait 27 seconds before trying again. [too-many-requests]","errorType":"Meteor.Error"}}',
    success: true
  }
}
API âž” debug POST: /api/v1/method.call/federation%3AgetServers
RateLimiter âž” info DDP RATE LIMIT: limit by userId per method
RateLimiter âž” info {
  "allowed": false,
  "timeToReset": 6863,
  "numInvocationsLeft": 0,
  "userId": "xxxxxxxxxxxxx",
  "clientAddress": "x.x.x.x",
  "type": "method",
  "name": "federation:getServers",
  "connectionId": "xxxxxxxxx",
  "broadcastAuth": false
}

Thank you

Triaged federation bug

Most helpful comment

I upgraded from 2.4.11 to 3.6.3 and have the same problem.

After taking a look at the code, and knowing that the error occurs in calls to federation:getOverviewData and federation:getServers, I think that the problem may be in client/contexts/ServerContext.ts:usePolledMethodData, as this function is only used for these two calls.

I don't have a local build that I can test this on, but could it be that the useEffect cache parameters ([fetchData, intervalMs]), are causing the effect to be executed in every frame update? Maybe fetchData is not being cached properly and is returning a new function every time?

All 10 comments


@piotrkochan can you please update to the latest version, 3.6.3, and check again?

@alansikora I'm already on 3.6.3

I confirm, same behavior in 3.6.3

Hi, same behavior in 3.7.0

federation_dash

That issue cause DDP Rate limiter go crazy when I just open federation dashboard
image
image

Hello,
I'm also have this exact issue after the updating from 3.4.x to 3.6. My log looks exactly like piotrkochan above, same line numbers etc. I've now updated to 3.7.1 and still the issue exists. The database migration seems to have worked fine.

I upgraded from 2.4.11 to 3.6.3 and have the same problem.

After taking a look at the code, and knowing that the error occurs in calls to federation:getOverviewData and federation:getServers, I think that the problem may be in client/contexts/ServerContext.ts:usePolledMethodData, as this function is only used for these two calls.

I don't have a local build that I can test this on, but could it be that the useEffect cache parameters ([fetchData, intervalMs]), are causing the effect to be executed in every frame update? Maybe fetchData is not being cached properly and is returning a new function every time?

After some local debugging, I think I found the issue. I opened a PR with the fix: #19386

For anyone not following the PR comments, it seems that this had already been fixed in https://github.com/RocketChat/Rocket.Chat/pull/18520, so I guess it will be included in the next release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kiran-Rao picture Kiran-Rao  Â·  3Comments

amayer5125 picture amayer5125  Â·  3Comments

marceloschmidt picture marceloschmidt  Â·  3Comments

engelgabriel picture engelgabriel  Â·  3Comments

royalaid picture royalaid  Â·  3Comments