Page MenuHomePhabricator

[Bug] Empty app_install_id and session_id in MobileWikiAppiOSSessions and MobileWikiAppiOSUserHistory
Closed, ResolvedPublic

Description

Looking at eventlogging data from 5.8.2 external beta, we found some records having empty app_install_id and session_id in MobileWikiAppiOSSessions and MobileWikiAppiOSUserHistory tables. These empty IDs don't seem to occur by chance -- ~10% records of MobileWikiAppiOSSessions table and ~30% records of MobileWikiAppiOSUserHistory table have at least one empty ID. Although I haven't found any convincing pattern or evidence from the data, it seems more than half of these problematic records are from iOS 11.4.

Hive query:

select *
from event.mobilewikiappiossessions
where year=2018
and (event.app_install_id=''
or event.session_id=''
)

select *
from event.mobilewikiappiosuserhistory
where year=2018
and (event.app_install_id=''
or event.session_id=''
)

Event Timeline

@chelsyx is there any way to get a list of unique build numbers that have this problem? In the user agent sent with the request, the build number is the number after the last . so in WikipediaApp/5.8.2.1410 (iOS 11.4; Phone) it's 1410

@JoeWalsh we can get the unique app version with the following hive query:

select distinct version
from (
select distinct useragent.wmf_app_version as version
from event.mobilewikiappiossessions
where year=2018
and (event.app_install_id=''
or event.session_id=''
)
union all
select distinct useragent.wmf_app_version as version
from event.mobilewikiappiosuserhistory
where year=2018
and (event.app_install_id=''
or event.session_id=''
)
) tb1

So the unique versions that have this problem is 5.8.2.1410 and 5.8.2.1412

JMinor triaged this task as Medium priority.Jun 4 2018, 6:12 PM
JMinor moved this task from Needs Triage to Bug Backlog on the Wikipedia-iOS-App-Backlog board.

@chelsyx Joe pushed a build with this hopefully fixed - 1415. I'm going to push that external now, but you should be able to check if 5.8.2.1415 is still having this issue.

@JoeWalsh I checked the data from 1415. So far all the records have app install ID (yay), but for some the session ID are still missing. For those users whose session IDs are missing, I pulled out all of their records and found that their session ID are not always missing -- it seems to be missing at random session_start event...

-- Get distinct app install id whose session IDs are missing
select distinct event.app_install_id
from event.mobilewikiappiossessions
where year=2018 and month=6
and useragent.wmf_app_version='5.8.2.1415'
and (event.app_install_id=''
or event.session_id=''
)

-- Get all records of certain user by app install ID
select *
from event.mobilewikiappiossessions
where year=2018 and month=6
and event.app_install_id='XXXXXXX'

More information about the bug:

In build 1415,
1, 3 out of 54 users have no session ID occasionally (they have session IDs in some sessions) in MobileWikiAppiOSSessions table. They all happened in session_start events.
2, For records missing session IDs in MobileWikiAppiOSUserHistory table, their timestamp matches the timestamps of those session_start events described in 1. Since the only time the app would send snapshot to MobileWikiAppiOSUserHistory table together with session_start event is when users start the app for the first time after install/update or opt-in in settings (otherwise snapshots are sent with the session_end timestamp), my guess is those events failed to get a session ID because too many things happened at the same time during app initiation, or the user toggle the opt-in option several times in a session. @JoeWalsh Does that make sense to you?
3, In MobileWikiAppiOSUserHistory table, there are only 17 unique users. The number should be 54 since the app should send a snapshot to MobileWikiAppiOSUserHistory table when users start the app for the first time after install/update or opt-in in settings. This happened probably for the same reason as 2, but I will create another ticket for it.

@chelsyx

the app should send a snapshot to MobileWikiAppiOSUserHistory table when users start the app for the first time after install/update or opt-in in settings

If the user opts out then opts back in via settings, should the app send a history snapshot even if it's identical to the last snapshot that was sent? Also, should this reset the session id? Should it also reset the install id?

Should the install id be the same if the user un-installs and re-installs to the same device? Or should it reset with every install?

@JoeWalsh According to @JMinor , for privacy reason, the install id should be reset when the user un-installs and re-installs to the same device, opt-out and opt back in on the same device. But the install id should not be reset when the user update the app.

When the install id is reset, we treat them as a new user, the session id should be reset, the app should send a snapshot with the new install id, even if everything else is the same as the history snapshot.

@JoeWalsh I just checked the data from build 1420, out of 122 users, only 1 record had empty app ID and session ID, and its IP address showed it's from our SF office:

dteventiprecvfromrevisionschemaseqiduseragentuuidwiki
2018-06-08T22:26:15{"action":"session_start","app_install_id":"","category":"unknown","event_dt":"2018-06-08T12:36:17-07:00","is_anon":true,"measure":null,"primary_language":"en","session_id":""}198.73.209.241cp4027.ulsfo.wmnet18064102MobileWikiAppiOSSessions26843903{"browser_family":"Other","browser_major":null,"browser_minor":null,"device_family":"Other","is_bot":false,"is_mediawiki":false,"os_family":"iOS","os_major":"11","os_minor":"3","wmf_app_version":"5.8.2.1420"}b1dac8858a2b51d8a3802abe79e48172enwiki

I guess it happened when Monte or someone test the build last Friday (cuz I was not in the office), but it's probably hard to reproduce.
Anyway, it's only 1 record, I think you fix it. YAY!!! Thanks so much!

I created T196933 for the snapshot bug mentioned in T196131#4259725.

Vvjjkkii renamed this task from [Bug] Empty app_install_id and session_id in MobileWikiAppiOSSessions and MobileWikiAppiOSUserHistory to 8ubaaaaaaa.Jul 1 2018, 1:06 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed JoeWalsh as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: JoeWalsh; removed: Aklapper.
CommunityTechBot renamed this task from 8ubaaaaaaa to [Bug] Empty app_install_id and session_id in MobileWikiAppiOSSessions and MobileWikiAppiOSUserHistory.Jul 2 2018, 1:47 PM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to JoeWalsh.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot edited subscribers, added: Aklapper; removed: JoeWalsh.