-
Notifications
You must be signed in to change notification settings - Fork 113
接触チェックに漏れが発生する可能性について #17
Comments
@yoshitomo-g 047b12b の変更で、すべてのTEKのダウンロード完了後に更新(266行目の cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs Lines 231 to 272 in b823e87
問題なさそうならCloseするので、何かあればreopenお願いします。 |
データの持ち方は変わりましたが、根本的なところでは変わっていないのではないでしょうか。 チェックまでのプロセスは次のように分けられると思うのですが、3で中断してしまった場合に、その続きから再開されるのではないというのが懸念事項です。1、3、2の順であれば良さそうですが。
私の見落としているだけで解消できているようであれば、Closeで構いません。 |
そうです。厳密に言えば、どこまでダウンロードしたかを管理して、チェックについてはダウンロードに依存している形ですね。 cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs Lines 129 to 194 in b823e87
メソッドの呼び出しとコールバックの中身は次のようになっています。 cocoa/Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.shared.cs Lines 88 to 120 in b823e87
正常に動作していれば問題なさそうですが、中断された場合は前日24時間分として配信された TEK がチェックされないことになるかと。今のところ配信は1日に1回で、アプリ側では新規配信がないかを1日に複数回確認しています。
1のほうが良い感じがしますが、 検証できないのでアルゴリズムだけになりますが、簡易的なトランザクションとしてこのような方法はどうでしょうか。 |
#68 の変更でどうですか?
UPDATE |
その理解で正しいと思います。
その事象は発生しないとぼくは考えています。 このIssueで指摘されている事象は「複数の診断キーをダウンロード中に、途中で通信が切断するなどの原因でダウンロードが中断し、再度ダウンロードした際に、前回の処理でダウンロードできてしまった診断キーについては『接触確認済』として取り扱われるので、本来されるべき接触確認が実行されない」と言うものと認識しています。 現在の処理では さて、ご指摘の cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs Lines 120 to 122 in b823e87
cocoa/Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.shared.cs Lines 88 to 120 in b823e87
#68 の変更では、 と理解しています。 UPDATE cocoa/Covid19Radar/Xamarin.ExposureNotification/CallbackService.android.cs Lines 38 to 63 in b823e87
|
一晩考えてみたのですが、これは結構根の深い問題でXamarin.ENの変更が必要になりそうです。 接触確認に漏れが発生する可能性「なにをもって接触確認を終えたと言うか」で対応が変わってくるのですが、 ただ、実際の接触確認は cocoa/Covid19Radar/Xamarin.ExposureNotification/ExposureNotification.shared.cs Lines 88 to 123 in b823e87
iOSの方は 一方Androidでは cocoa/Covid19Radar/Xamarin.ExposureNotification/CallbackService.android.cs Lines 13 to 33 in b823e87
このBroadcastReceiverが呼ばれた時点が接触確認が終わったと言えます。 修正について修正についてですが、問題は、このBroadcastReceiverがXamarin.ENの中にあることです。現時点でプロジェクトの中にあるので変更はできますが、将来のことを思えば触りたくないなという気持ちがあります。 代替案として考えたのは、 この方法を採る上での課題は、iOSとAndroidで iOS側ではXamarin.ENの外に「接触がなかった」と言うイベントを検出する手段が提供されていません(Androidでは ひとまず本IssueはPRも含めてCloseせず、検討を継続していきたいと考えています。 |
見れていない間に話が大きくなっていて、今更になってしまうかもしれませんが・・・。
わかりにくい表現で失礼しました。変数としては この値は複数の TEK をまとめたzipファイルのタイムスタンプで、
配列をループ処理しながら、zipファイルのダウンロード(L240~257)とタイムスタンプである cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs Lines 231 to 267 in b823e87
私の認識と少し違うようなので、すり合わせをさせてください。 危惧しているタイミングは「複数の診断キーをダウンロード中に」ではなく、 |
#68 に先に書いてしまいましたが、私自身は EN に関する懸念事項を Google に確認することはできないのでしょうか? |
わたしも Google に聞いたほうが早そうという気がしますが。 #68 (comment) で @tmurakami さんが参照されているのは EN v1 時代の最後のものは 2020-06-26版 https://github.com/google/exposure-notifications-android/tree/1b215ca7fc99cac292b56a87751421bd1065df75 ですがそもそも downloadServerRepo にあたる v1/v2 など見比べてみての想像なのですが EN v1 が deprecated になった理由の一つが、#17 (comment) でも つまり、Android 版の EN v1 では
という処理順序で 4. まで実行して初めて通知(notification)が表示されるので、 上記の EN v1 のころのサンプルでも token を全部呼び出し時に保存して Receiver の処理が完了したら処理済みとしてmarkするような実装をしているようです (mark されなかったのはどうするんだろうか?) これをいくら厳密に直しても二重通知は回避できないので、EN v1.5 以降では token の概念を捨てて、 なので、諸々考え合わせると Google に問い合わせると EN v1.5 以降最新版にしてねという答えが返ってきてしまいそうな気がします。 あと、iOS 側の getExposureWindows は引数に ENExposureDetectionSummary を取る https://developer.apple.com/documentation/exposurenotification/enmanager/3644438-getexposurewindows |
@zipperpull ご説明ありがとうございます。理解できました。 個人的には暫定で良いので 今年 1月の |
わたしも @tmurakami さんや @yoshitomo-g さんがおっしゃるように
ひとまずここまでを早めに(できるなら今回リリースで?)対応いただくのがよさそうと思いますが だけマージする必要があるイメージで合っていますよね? |
はい、そのイメージです。 |
ありがとうございます。寝て起きたらいろいろ情報が出ていて驚いています。
ご指摘の通り「ダウンロード中断時に…」というのは、ぼくの認識に誤りがありました(PRを作っていて気づきました)。 #68 についてはひとまず 43275b8 のみに変更する方向でいきます。EN APIに関してはGoogle(およびApple)から協力を得ることができるフローがあるので、引き続き調査を進めていきたいと考えています。 ぼくとしては昨日の朝に改善に着手した時に、修正自体は単純なものだろうと思っていたのですが、複雑な迷路に迷い込んだ感じです。
corona-warn-app/cwa-app-android#2081 についても情報ありがとうございます。不勉強ながらぼく自身がこの事例を知らなかったので、とても勉強になります。 |
一応イギリスの issue はこちらです この #17 とは別問題じゃないかとは思いますが。。(原因不明なのでわかりませんけど) |
Google の provideDiagnosisKeys の仕様だと Task が返されるので、broadcast 送信までは完了した時点で もしそうなると仮定すると、呼び出し前に token を保存して、Success した token のぶんは 追記: 保存まで終わったらそれは別のフラグ (mark 相当) をたてる必要もありますね(複雑) |
今のXamarin.ENだとtokenはXamarin.ENの中で生成しているので、そこを変えないといけませんね。 |
#68 の変更が効果があることを確認できました。 https://twitter.com/h_okumura/status/1404221661591658499
|
無事 iOS 版でもリリースされ、効果も確認されたようでホッとしています。 理由は単純で、後から参加した人がリリースとIssueの対応を見るときに分かりにくくなりそうだと思ったからです。 |
そもそもの懸念していたことが解消されたということであれば、私は close で良いと思います。#17 (comment) で暫定対応という方針が出ていますし。 |
@yoshitomo-g それでは本IssueはCloseしますね。 |
iOS版のコードを追いかけていて気が付いたのですが、zipファイルのダウンロード完了後に処理が中断した場合、この時のzipファイルに含まれる診断キーとの接触チェックが行われずに漏れてしまうように思えます。具体的には、次の行以降です。
cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs
Line 164 in 3eac4f4
この行のメソッドでは、各zipファイルの
Created
の値を、最後にダウンロードしたzipファイルのCreated
であるlastTekTimestamp[region]
と比較し、ダウンロードするかどうかを決めています。cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs
Lines 234 to 274 in 3eac4f4
lastTekTimestamp[region]
はダウンロード毎に更新されます。すべてのzipファイルがダウンロードされるとlastTekTimestamp
がuserData.LastProcessTekTimestamp
に反映され、直後にuserData
の保存処理が呼ばれます。cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs
Lines 276 to 277 in 3eac4f4
接触チェックはダウンロード後に行われるため、ダウンロードしかしていなくても
userData.LastProcessTekTimestamp
が更新され、次回のダウンロードに参照されます。チェックの対象になるのは直前のダウンロードされたzipファイルのみなので、未チェックのファイルを見つけてこれに加えるような仕組みがないのであれば、冒頭で挙げたところで中断した場合は、その分が対象になりません。
cocoa/Covid19Radar/Covid19Radar/Services/ExposureNotificationHandler.cs
Line 176 in 3eac4f4
C#のコーディング経験がないため勘違いもあるかもしれませんが、影響が大きいと思いましたので検証していただけると幸いです。
Internal IDs:
The text was updated successfully, but these errors were encountered: