Mattermost marking users "offline" when they are "away"

Thanks for the feedback @Ju_St,

Let us know what you find… :slight_smile:

I can confirm that the problem is resolved by changing to any of the default templates. Also other users don’t face the issue if they don’t use customized templates. Hope that helps!

1 Like

We use default templates and still have this issue.

Hi @cpc,

Could you share which server version of Mattermost you have installed? There have been a few releases since this issue was first opened in October last year and I’m wondering whether it will still reproduce for you if you upgrade to the latest version?

Good to hear! Thanks @Ju_St!

Strangely enough the issue re-appeared a few days ago. It was working fine after switching to one of the standard templates, but now the status shows as offline again, when the window is minimized for a while.

Hi @Ju_St,

Thanks for your feedback,

To clarify, are you saying the status goes to “offline” (as opposed to “away”) when the tab is minimised?

Yes, that is correct. It’s only the status display that shows the user as offline, everything else works, as if the user would be away/online. The weird thing is also that it doesn’t occur every time the window is minimized, but only at random occasions. When the bug occurs, re-opening the window will not switch the status display immediately, even when typing and sending a message (it’ll show the user as offline). Manually changing the status to online takes immediate effect. Also it’ll jump to online after a little while.

Thanks for your feedback @Ju_St,

Can you confirm you have upgraded to Mattermost server version 4.9 and Desktop App 4.0.1?

It will help to know this so we can help troubleshoot…

yes, I’m running both 4.9 and 4.0.1. Problem just occurred again.

The issue still happends with me also.

The db i use is the same i used in the previous version i had, an old one. Could be related to that?

Thanks for the feecback @Ju_St @cpc

I’m not sure whether it could be because of an old database in a new server version… I’ll check with our engineers and ask for their help troubleshooting…

Is there anything on the Mattermost logs about the websocket connections? maybe you’ll need to set the log level to DEBUG while you encounter this issue to see if there is anything in the logs that might be of help.

I’m getting this errors:

[2018/04/23 10:53:02 WEST] [DEBG] websocket.read: closing websocket for userId=wj81sxwohinoxyfeziydxsknkh error=websocket: close 1006 (abnormal closure): unexpected EOF
[2018/04/23 10:53:15 WEST] [DEBG] websocket.ticker: closing websocket for userId=4rr7mh44ypba989i9mhs9cq1uh error=write tcp 192.xxx.xxx.xxx:8064->192.xxx.xxx.xxx:55691: use of closed network connection
[2018/04/23 10:53:15 WEST] [DEBG] websocket.ticker: closing websocket for userId=d4in7usssfnmuk61hd4ajsfmkh error=write tcp 192.xxx.xxx.xxx:8064->192.xxx.xxx.xxx:55703: use of closed network connection

So by the looks of this it seems that the WebSocket connection is getting disconnected for the different users which is strange, do you have a reverse proxy in front of the Mattermost server? if so an you share the configuration?

yes i have a reverse proxy on nginx:

server {
   listen 443 ssl http2;
   server_name xx.xxxx.com;
   ssl on;
   ssl_certificate /etc/ssl/certs/xxx.com.pem;
   ssl_certificate_key /etc/ssl/certs/xxx.com.key;
   ssl_session_timeout 5m;
   ssl_protocols TLSv1.1 TLSv1.2;
   ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
   ssl_prefer_server_ciphers on;
   ssl_session_cache shared:SSL:10m;
   location / {
      gzip off;
      proxy_set_header X-Forwarded-Ssl on;
      client_max_body_size 100M;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Frame-Options SAMEORIGIN;
      proxy_pass http://192.xxx.xxx.xxx:8064;
   }
}

Hello Elias, below is our nginx config:

upstream backend {
   server 139.XXX.XXX.XXX:8065;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;

server {
   listen 80 default_server;
   server_name   xxxx.xxxx.com ;
   return 301 https://$server_name$request_uri;
}

server {
   listen 443 ssl http2;
   server_name    xxxx.xxxx.com;

add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;

ssl on;
  ssl_certificate /etc/letsencrypt/live/xxxx.xxxx.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/xxxx.xxxx.com/privkey.pem;
  ssl_session_timeout 5m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA HIGH !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SR$
  ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparams.pem;
  ssl_session_cache shared:SSL:10m;

   location ~ /api/v[0-9]+/(users/)?websocket$ {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_pass http://backend;
   }

   location / {
        proxy_http_version 1.1;
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache mattermost_cache;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_pass http://backend;
   }
}

@Ju_St config looks about right and @cpc looks kind of old

Now the only two things that both have in common are the ciphers and other ssl options, would you want to try and remove the ssl options that are not mentioned in the official docs?

also what about the additional headers added? I just want to see if any one of those are causing issues.

I removed the add_header sections, but the problem persists.

@Ju_St Following up on what Elias suggested, would you also want to try remove the ssl options that are not mentioned in the official docs?