Mattermost, Inc.

Unread count on IOS app doesn't work after upgrade

I recently upgraded to 5.20 and now the unread count on the iOS app for all of my users just works maybe 1 out of every 100 times. I switched from an Apache reverse proxy to an nginx one but that doesn’t seem to have made a difference.

What Mattermost mobile app version are you on?

looks like i’m on 1.29.0

Can you share a screenshot of what you’re seeing?
Are users getting push notifications?

So I get the lock screen, notification center, and banner notifications (usually - although this doesn’t seem as consistent either) but I rarely get the badge notifications with the red number indicating the number of unread messages.

Would you be able to check if clearing your current active sessions via Account Settings > Security > View and Logout of Active Sessions (and then logging back in) helps?

Another option could be to check if upgrading to v5.21 helps with the issue.

Ok - i tried doing the clearing of all active sessions. That didn’t resolve it. I then did the upgrade to 5.21.0 and then tried again - that didn’t work. I then closed all active sessions again and still doesn’t work.

Hello, @richardsonje

For sanity check purposes, can you confirm how the Settings > Mattermost > Notifications look like on from the affected user’s iOS device?

For comparison purposes, can you confirm that the unread counter is showing as expected for desktop and web app

Ok yes that’s how it looks. This isn’t impacting just me, this is impacting the 4 users using the server. through the last couple days I’ve noticed that it is doing a few weird things:
1.) When you open the iOS app, it will take you to a random position above the current messages
2.) Sometimes the unread indicator inside the app will kind of stick
3.) If I get the unread count to show, i have to close the app to get it to mark as read and then it won’t show the unread count for a while
4.) The unread count indicator doesn’t seem to work on any of the apps - whether it’s on the Mac or iOS

Any other thoughts on this one? Would providing any of my proxy config help?

Please help send more details about your config and any log errors you’re seeing.

1 Like

Hi, @richardsonje

Yes, please. Please provide all the configuration as well as the mattermost.log when you reproduce the issue so we can dig deeper into this issue. Thanks.

I’m not really sure how I can forcibly reproduce it - they just don’t work. I would say maybe 1 out of every 100 messages now, if that, I get the badge number.

I’m looking through the logs and these are the only errors I see:

{“level”:“error”,“ts”:1585623183.4068193,“caller”:“app/web_conn.go:282”,“msg”:“Invalid session.”,“error”:"GetSession: Invalid session token=mm74btdgwino3r5ws186oez69a, err=, "}
{“level”:“info”,“ts”:1585623184.7250674,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=1km9optryb8hig1p5oquwtr4jh, err=, "}

The second one repeats a few times.

A little bit on my setup (and, again, this all worked fine before upgrading to version 5.x - the only difference was I was using an Apache proxy but I had this in place still post-upgrade and it was not working with Apache either):

Chat server: CentOS 8, went through the Mattermost Documentation for the setup and didn’t modify anything. SELinux is running.

Proxy Server: CentOS 8, nginx 1.14.1, here’s the conf file for the proxy:

upstream backend {
server 10.20.5.30:8065;
keepalive 32;
}

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;
server_name chat.domain.com;

  include snippets/letsencrypt.conf;
  return 301 https://$server_name$request_uri;

}

server {
listen 443 ssl http2;
server_name chat.domain.com;

   ssl on;
   ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
   ssl_trusted_certificate /etc/letsencrypt/live/domain.com/chain.pem;

   ssl_session_timeout 1d;
   ssl_protocols TLSv1.2;
   ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
   ssl_prefer_server_ciphers on;
   ssl_session_cache shared:SSL:50m;

   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;
           client_body_timeout 60;
           send_timeout 300;
           lingering_timeout 5;
           proxy_connect_timeout 90;
           proxy_send_timeout 300;
           proxy_read_timeout 90s;
           proxy_pass http://backend;
   }

   location / {
           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_http_version 1.1;
           proxy_pass http://backend;
   }

}

Let me know what else I can provide that’d be helpful

I’ve made an interesting observation the last few days. If I let maybe 10-12 messages go without reading any of them, THEN it will show the badge count. That seems to be the only way I get to see it is when that happens.

@ahmaddanial Does the additional information shared above provide a better indication what the issue might be?

Hi, @richardsonje

I don’t see anything obvious in the proxy configuration with reference to Configuring NGINX with SSL and HTTP/2 that could impact the badge counter on the iOS app directly. This one is definitely out of the ordinary:

@amy.blais I’ll ping the mobile developers on this to get their insight on what could have impacted the unread counter.

Does the unread badge has an incorrect number or it does not show at all?

If it had a different number, are there any archived channels with mentions? Deactivated users?

If the badge is never set, do you get the notification at all? Can you help send the notifications.log file?

No badge shows at all. Here’s a link to my onedrive with the notifications log.

Hello, @richardsonje

Thanks for the update. Before I share this with the team, can you please provide me with the following information so I can cross check the log entries?

SELECT u.Id, u.Username, u.Email, s.DeviceId, s.Props FROM Users AS u RIGHT JOIN Sessions AS s ON s.UserId = u.Id AND u.Username = "<username>";

Keep me posted. Thanks.

Id, Username, Email, DeviceId, Props

NULL, NULL, NULL, ‘apple_rn:9f2844888b6c582ab85cbecb5ce174ba9618b82b710534c1e3a595b54235b8f4’, ‘{“browser”:“Safari/13.3.1”,“csrf”:“m6ft4f9bajnt3bmb1ofpr6qypo”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Chrome/76.0.3809”,“csrf”:“rwaasjtecpn758ssingawiexuc”,“is_guest”:“false”,“os”:“Windows 10”,“platform”:“Windows”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Safari/13.1.3”,“csrf”:“48jho415opytiry64uhws8ghry”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Chrome/77.0.3865”,“csrf”:“b7ubcy1abp8czjycr5geeejs4y”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Desktop App/4.3.1”,“csrf”:“1967ydrtq3fyicgp4iz9errj3h”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Firefox/74.0”,“csrf”:“xeb7py3e3jdnxr997qq6bybwxr”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Chrome/77.0.3865”,“csrf”:“sbii39ngzbbpies36jfqcj714h”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Safari/13.0.1”,“csrf”:“xgeah6kxo3gjxj164e81y31sxr”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Chrome/79.0.3945”,“csrf”:“694txrricpnt5xyp1zqd44dxya”,“is_guest”:“false”,“os”:“Android”,“platform”:“Linux”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Chrome/77.0.3865”,“csrf”:“thgz768hrprgjjxttgiysogs9c”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’
NULL, NULL, NULL, ‘apple_rn:5570179a889af069398d162868ece9d766419e090e2bd0f8feb5ef7f5e8144f2’, ‘{“browser”:“Safari/13.1.3”,“csrf”:“r4yq85k3pt8fidthoqa3i45gca”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Desktop App/4.4.0”,“csrf”:“y7g4ben81fbr9mkpurahtn6s7a”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’
NULL, NULL, NULL, ‘apple_rn:de9ceb1b657d67695f1fd93f886dc9bbb8f40094931bd87643cfd05d29a86adb’, ‘{“browser”:“Safari/13.1.3”,“csrf”:“5j3qqjxrstgxppo5fe13j8pagh”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”}’
NULL, NULL, NULL, ‘’, ‘{“browser”:“Chrome/77.0.3865”,“csrf”:“cahedppfw7f9dnpd4tsm6xbp5o”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”}’

That looks really ugly posted … let me know if you need me to clean it up