Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Multiple server deployment constantly needs to be reloaded in order to receive messages

Open vytautasgimbutas opened this issue 10 years ago • 29 comments

Your Rocket.Chat version: 0.37.1

After upgrading from 0.35.0 to 0.37.1 I need to constantly refresh the client in order to receive the latest messages. The socket seems to be okay and pushes/receives ping/pong requests, but not the messages.

screen shot 2016-08-22 at 5 58 32 pm

Any ideas what's wrong? Is it possible to somehow downgrade to 0.35.0, because just changing the version back doesn't help?

vytautasgimbutas avatar Aug 22 '16 15:08 vytautasgimbutas

Occasionally after a refresh I will receive messages for some time, but then it will stop and again a refresh will be required.

Tried setting log level to the highest, checked what happens when a message is sent and received and when it's sent but not received on the other side. They are both identical and looks like this:

Meteor ➔ method stream-notify-room -> userId: B2fHx9bd369Xe4usE , arguments:  { '0': 'B2fHx9bd369Xe4usEJbSwAEWLmW4ZQ8gg7/typing',
  '1': 'Saulius.Nevys',
  '2': true }
Meteor ➔ method stream-notify-room -> userId: B2fHx9bd369Xe4usE , arguments:  { '0': 'B2fHx9bd369Xe4usEJbSwAEWLmW4ZQ8gg7/typing',
  '1': 'Saulius.Nevys',
  '2': false }
Meteor ➔ method sendMessage -> userId: B2fHx9bd369Xe4usE , arguments:  { '0':
   { _id: '8MmBFYhvz6tTK8xXn',
     rid: 'B2fHx9bd369Xe4usEJbSwAEWLmW4ZQ8gg7',
     msg: 'a\n' } }
Meteor ➔ method canAccessRoom -> userId: B2fHx9bd369Xe4usE , arguments:  { '0': 'B2fHx9bd369Xe4usEJbSwAEWLmW4ZQ8gg7',
  '1': 'B2fHx9bd369Xe4usE' }

vytautasgimbutas avatar Aug 22 '16 15:08 vytautasgimbutas

We're seeing this as well, we're sticking with our current version until this is resolved.

lochiiconnectivity avatar Sep 14 '16 15:09 lochiiconnectivity

@lochiiconnectivity I was told that the issue was with renaming channel "#general". Once we put it back to #general everything started to work correctly. I'm not sure, maybe this was a coincidence.

vytautasgimbutas avatar Sep 14 '16 15:09 vytautasgimbutas

We haven't renamed it at all, I'm afraid.

lochiiconnectivity avatar Sep 14 '16 15:09 lochiiconnectivity

Here we have the same issue with version 0.39 when using rocket with a load balancer, with only one instance everything works fine. We are curently trying to fix it by configuring our load balancer to support correctly websockets.

meltenc avatar Sep 14 '16 16:09 meltenc

we are also in a load balanced environment , what do you mean by fixing your load balancer? what do you think is wrong with it? is it currently working? did something change for you in 0.39.0 where you feel you now have to do this?

lochiiconnectivity avatar Sep 14 '16 17:09 lochiiconnectivity

We thought it has something to do with our load balancer configuration (sticky session or webscoket issue), but it appears since version 0.38 or 0.37, so it should be something with the these releases and the fact we are load balancing rocket because everything works fine without it...

meltenc avatar Sep 14 '16 20:09 meltenc

We just went into production with nginx as the load balancer fronting 12 instances of RC version 0.42.0. on 3 different servers. My users started to contact me on this specific issue. I can re-start nginx and its fine for a period of time. Since the last comment was 28 days ago did someone find a way to resolve this issue? Currently I changed my config on the nginx side to point to one server with 4 RC instances. It seems that there are issues here to. I've now changed it to one RC instance. On nginx. I had least_conn; and ip_hash. I remove the least_conn; and still have the hash_ip;. Does anyone have some standards in this area or advice?

drickerusa avatar Oct 12 '16 18:10 drickerusa

Hey, we're running a similar setup as you @drickerusa and ran in to this issue when upgrading from 0.37.1 to 0.39.0, as a result we rolled back and we've been stuck on 0.37.1 with no upgrade path for the last couple of months. Keen for an update from the team on this, even a suggestion of where to look to troubleshoot/fix this problem is a start.

jamie-owen avatar Oct 13 '16 15:10 jamie-owen

@Jamie-Owen I pared down to one server running 5 instances and used this in my rocketchat.conf file created by the forever-service. env INSTANCE_IP=. This variable is also referenced in "Multiple instances of nodejs fails to propagate messages #4019". I put it on all of my machines, but I'm not sure it really matters because it still manifested itself on multiple machines with multiple instances. I need to do some testing in my staging environment, but I first need to setup another machine to do this.

drickerusa avatar Oct 19 '16 14:10 drickerusa

I'm also runnig in multiple machines setting the INSTANCE_IP and also had some reports of messages not propagating, but now it occurs silently without report StreamBroadcast error. Version 0.43.

ronaldosaheki avatar Nov 02 '16 18:11 ronaldosaheki

I was seeing this same issue when we were on heroku. I believe it had something to do with the websocket connections idling out. See https://github.com/RocketChat/Rocket.Chat/issues/4589

I've since moved to Digital Ocean and installed with snap. Everything is working again and feels a lot tighter.

kevincolten avatar Nov 02 '16 19:11 kevincolten

Just to clarify, this issue is related to deployments running multiple instances of RC behind a load balancer. We have done some work on this to facilitate the streaming across the multiple servers. We will give you more info shortly.

engelgabriel avatar Nov 03 '16 03:11 engelgabriel

Thanks for the update @engelgabriel I'm currently using one server with 5 instances and this is performing well. Once the fix is in I'll add one of the other servers with more RC instances.

drickerusa avatar Nov 03 '16 15:11 drickerusa

Thanks for the update @engelgabriel. Also thanks @drickerusa, I think we'll move to a similar set up as per your suggestion until 0.46.0 so we can try out some of the recent features.

jamie-owen avatar Nov 03 '16 18:11 jamie-owen

https://github.com/RocketChat/Rocket.Chat.Docs/issues/87

Check that out. Maybe it can help.

TheReal1604 avatar Nov 03 '16 18:11 TheReal1604

Any update on this issue? I am running into the same problem when using nginx to load balance multiple RC docker containers.

tasmar avatar Nov 16 '16 15:11 tasmar

We're seeing this impact notifications as well in our instance. Some users are not getting notifications while others do.

cujarrett avatar Nov 17 '16 20:11 cujarrett

@tasmar @matt-jarrett someone of you checked my guide posted above...?

TheReal1604 avatar Nov 17 '16 20:11 TheReal1604

@TheReal1604 I have not had time to try it. I will work on it next week and post my results when I have ran some tests.

tasmar avatar Nov 18 '16 16:11 tasmar