Unread count on IOS app doesn't work after upgrade

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

Hello, @richardsonje

That looks a handful. Can you please log out from every session and only log in to the iOS device to reproduce the issue before generating a new notification.log? That will help to narrow down the issue better. Thanks.

Been a little crazy at work and home and just settling down. Ok - should I sign out EVERYONE or just me from all devices? I think I did that not long before I sent that log but I can do this again

OK, here’s the result from the query you requested:

±---------------------------±---------±----------------------±--------------------------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------------------+
| Id | Username | Email | DeviceId | Props |
±---------------------------±---------±----------------------±--------------------------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------------------+
| NULL | NULL | NULL | apple_rn:5570179a889af069398d162868ece9d766419e090e2bd0f8feb5ef7f5e8144f2 | {“browser”:“Safari/13.3”,“csrf”:“pfxanmzbxinkzedx5k6ianm67y”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”} |
| bsaan4e6pfbrxd8umc973ymxty | jeremy | jeremy@domain.one | apple_rn:9f2844888b6c582ab85cbecb5ce174ba9618b82b710534c1e3a595b54235b8f4 | {“browser”:“Safari/13.3.1”,“csrf”:“pkbdqbga17fzmbtuzsic1nmurh”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”} |
| NULL | NULL | NULL | | {“browser”:“Safari/13.0.5”,“csrf”:“x6tqesbnopnq5gp74imf7ob51a”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”} |
| NULL | NULL | NULL | apple_rn:de9ceb1b657d67695f1fd93f886dc9bbb8f40094931bd87643cfd05d29a86adb | {“browser”:“Safari/13.3.1”,“csrf”:“yu5riurj6fy95q3exjb78w9bxa”,“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/80.0.3987”,“csrf”:“1r6ih96yrpbxffiug1sz1kz5aa”,“is_guest”:“false”,“os”:“Windows 10”,“platform”:“Windows”} |
| NULL | NULL | NULL | | {“browser”:“Firefox/74.0”,“csrf”:“8r58opkijpgddj64oqwcdszmeo”,“is_guest”:“false”,“os”:“Mac OS”,“platform”:“Macintosh”} |
±---------------------------±---------±----------------------±--------------------------------------------------------------------------±-----------------------------------------------------------------------------------------------------------------------------+

Here’s my error log:

{“level”:“error”,“ts”:1587400887.3557847,“caller”:“mlog/log.go:175”,“msg”:“Enter a valid email or username and/or password.”,“path”:“/api/v4/users/login”,“request_id”:“5xnbmf5sgfyoxk1a7rpwarqpcr”,“ip_addr”:“10.10.3.162”,“user_id”:“”,“method”:“POST”,“err_where”:“login”,“http_code”:401,“err_details”:“”}
{“level”:“error”,“ts”:1587400931.431108,“caller”:“mlog/log.go:175”,“msg”:“Enter a valid email or username and/or password.”,“path”:“/api/v4/users/login”,“request_id”:“bxcsicbt8tymfbrbereifobppa”,“ip_addr”:“10.10.3.162”,“user_id”:“”,“method”:“POST”,“err_where”:“login”,“http_code”:401,“err_details”:“”}
{“level”:“error”,“ts”:1587401002.8468738,“caller”:“mlog/log.go:175”,“msg”:“Enter a valid email or username and/or password.”,“path”:“/api/v4/users/login”,“request_id”:“swnmirbykfrupydinosorrix9h”,“ip_addr”:“10.10.3.162”,“user_id”:“”,“method”:“POST”,“err_where”:“login”,“http_code”:401,“err_details”:“”}
{“level”:“error”,“ts”:1587401017.8027334,“caller”:“mlog/log.go:175”,“msg”:“Enter a valid email or username and/or password.”,“path”:“/api/v4/users/login”,“request_id”:“kg6ufdmmxtg39g13naw8jxs1fh”,“ip_addr”:“10.10.3.162”,“user_id”:“”,“method”:“POST”,“err_where”:“login”,“http_code”:401,“err_details”:“”}
{“level”:“error”,“ts”:1587401044.8230484,“caller”:“mlog/log.go:175”,“msg”:“Enter a valid email or username and/or password.”,“path”:“/api/v4/users/login”,“request_id”:“opdrxohr5bbumm639c6jjr5sgo”,“ip_addr”:“205.237.121.1”,“user_id”:“”,“method”:“POST”,“err_where”:“login”,“http_code”:401,“err_details”:“”}
{“level”:“error”,“ts”:1587401055.4120007,“caller”:“mlog/log.go:175”,“msg”:“Enter a valid email or username and/or password.”,“path”:“/api/v4/users/login”,“request_id”:“936riusf378bzgmsj9p9u9wqje”,“ip_addr”:“205.237.121.1”,“user_id”:“”,“method”:“POST”,“err_where”:“login”,“http_code”:401,“err_details”:“”}

And I’m also seeing these:

{“level”:“error”,“ts”:1587711497.1088774,“caller”:“mailservice/mail.go:153”,“msg”:“Failed to open a connection to SMTP server”,“error”:“EOF”}
{“level”:“error”,“ts”:1587711497.10896,“caller”:“app/notification_email.go:103”,“msg”:“Error while sending the email”,“user_email”:“jeremy@domain.one”,“error”:“SendMail: Failed to open TLS connection, EOF”}

{“level”:“info”,“ts”:1587228834.84112,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}
{“level”:“info”,“ts”:1587228834.8415837,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}
{“level”:“info”,“ts”:1587228834.88413,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}
{“level”:“info”,“ts”:1587228834.8842106,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}
{“level”:“info”,“ts”:1587228834.8846433,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}
{“level”:“info”,“ts”:1587228834.8848343,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}
{“level”:“info”,“ts”:1587228834.8850775,“caller”:“mlog/log.go:167”,“msg”:“Invalid session”,“error”:"GetSession: Invalid session token=xyk4yx9xn3rstb3cfcajzdt7wa, err=, "}

Hello, @richardsonje

Thanks for the update. So, I believe that we will be focusin on the ID bsaan4e6pfbrxd8umc973ymxty8 assigned to the user jeremy@domain.one:

| bsaan4e6pfbrxd8umc973ymxty | jeremy | jeremy@domain.one | apple_rn:9f2844888b6c582ab85cbecb5ce174ba9618b82b710534c1e3a595b54235b8f4 | {“browser”:“Safari/13.3.1”,“csrf”:“pkbdqbga17fzmbtuzsic1nmurh”,“is_guest”:“false”,“os”:“iOS”,“platform”:“iPhone”} |

The error log you shared only shows the error with the login:

Enter a valid email or username and/or password

However, the last part of the log is the one that catches my attention, the info related to invalid session token. Are you getting that from the mattermost.log or notification.log itself and is the token xyk4yx9xn3rstb3cfcajzdt7wa associated with any of the accounts?

Can you also install the latest 1.30.1 mobile app too? Once done, please go through the Testing push notifications and let me know how it goes.

I got that info from the system console under the logs - is the notifications log on the linux box itself? I can provide that.

I’ll do the push notifications test later tonight

One of these day’s i’ll have free time again and won’t take weeks at a time to stay on this.

I’ve just copied up the logs to here:

I don’t think I have the tokens setup really but I can check if you tell me how. I made sure I have the log level set to DEBUG and then I did the troubleshooting process after I signed out of all devices that were not my iPhone. I get the push notification, but the badge indication never shows up. I am on the latest version of the iOS app.

Anything else i can provide to help?