corona-warn-app / cwa-app-ios

Native iOS app using the exposure notification framework from Apple. The CWA development ends on May 31, 2023. You still can warn other users until April 30, 2023. More information:

Home Page:https://coronawarn.app/en/faq/#ramp_down

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CWA does not perform risk checks in the background for 3 days, opens with ENF error 13

Ein-Tim opened this issue · comments

commented

Avoid duplicates

  • Bug is not mentioned in the FAQ
  • Bug is specific for iOS only, for general issues / questions that apply to iOS and Android please raise them in the documentation repository
  • Bug is not already reported in another issue

Technical details

  • Device name: iPhone 6s
  • iOS version: 15.7.1
  • App version: 2.28.0

Describe the bug

As always, I had my second device at my flat, connected to WLAN and always with enough power. However, when I opened CWA on the 28.11.2022 CWA welcomed me with the error 13 pop up and the information that the last risk check was performed 3 days ago, on 25.11.2022. This information seems to be accurate, as the ENF log in the system settings also shows this 3 day gap. It doesn't make any sense that CWA shows error 13 (rate limit exceeded) although there were 0 checks in the last 24h.

Steps to reproduce the issue

Not sure.

Expected behavior

Regularly performed checks and no faulty error 13.

Possible Fix

Could it be that something with the error 13 thing is implemented wrong in CWA or iOS?

Additional context

I logged all of that! You can find the log file for the timespan 2022-11-25 till 2022-11-28 here: https://gist.github.com/Ein-Tim/d97d66e21852cfdf33e65ac1db963015:

If you need the full log, which covers the timespan 2022-06-22 till 2022-11-28, let me know (:

commented

Quick analysis of the log:

  • something with ENError 16
  • and then this:
Error 2022-11-27T21:53:11Z
[ENA/ExposureDetection.swift:113] [endPrematurely(reason:)]
ExposureDetection: End prematurely.
ErrorLocalizedDescription: Fehler 13: Ihre Risiko-Ermittlung für den heutigen Tag wurde bereits durchgeführt. Bitte versuchen Sie es in 24 Stunden erneut.
Error: noExposureWindows(Error Domain=ENErrorDomain Code=13 "(null)" UserInfo={cuErrorMsg=Max per-day API limit reached: 6}, date: 2022-11-27 21:53:11 +0000)
Info 2022-11-27T21:53:11Z
[ENA/AppleFilesWriter.swift:37] [cleanUp()]
Removing: file:///private/var/mobile/Containers/Data/Application/C140C16A-F326-45B9-BE5F-949D08641619/tmp/keypackages/E30A72A6-340C-4F42-811F-783BA4F9A1B3/
Error 2022-11-27T21:53:11Z
[ENA/AppleFilesWriter.swift:43] [cleanUp()]
Can't remove item at file:///private/var/mobile/Containers/Data/Application/C140C16A-F326-45B9-BE5F-949D08641619/tmp/keypackages/E30A72A6-340C-4F42-811F-783BA4F9A1B3/
ErrorLocalizedDescription: „E30A72A6-340C-4F42-811F-783BA4F9A1B3“ konnte nicht entfernt werden.
Error: Error Domain=NSCocoaErrorDomain Code=4 "„E30A72A6-340C-4F42-811F-783BA4F9A1B3“ konnte nicht entfernt werden." UserInfo={NSUserStringVariant=(
    Remove
), NSFilePath=/private/var/mobile/Containers/Data/Application/C140C16A-F326-45B9-BE5F-949D08641619/tmp/keypackages/E30A72A6-340C-4F42-811F-783BA4F9A1B3, NSUnderlyingError=0x283f7d770 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Info 2022-11-27T21:53:11Z
[ENA/RateLimitLogger.swift:52] [logEffect(result:blocking:)]
Soft rate limit would NOT have prevented this ENError 13

Info 2022-11-27T21:53:11Z
[ENA/RateLimitLogger.swift:54] [logEffect(result:blocking:)]
Previous ENError code = 16

Error 2022-11-27T21:53:11Z
[ENA/RiskProvider.swift:363] [executeExposureDetection(appConfiguration:completion:)]
RiskProvider: Detect exposure failed
ErrorLocalizedDescription: Fehler 13: Ihre Risiko-Ermittlung für den heutigen Tag wurde bereits durchgeführt. Bitte versuchen Sie es in 24 Stunden erneut.
Error: noExposureWindows(Error Domain=ENErrorDomain Code=13 "(null)" UserInfo={cuErrorMsg=Max per-day API limit reached: 6}, date: 2022-11-27 21:53:11 +0000)

Info 2022-11-27T21:53:11Z
[ENA/RiskProvider.swift:497] [failOnTargetQueue(error:updateState:)]
RiskProvider: Failed with error: failedRiskDetection(ENA.ExposureDetection.DidEndPrematurelyReason.noExposureWindows(Error Domain=ENErrorDomain Code=13 "(null)" UserInfo={cuErrorMsg=Max per-day API limit reached: 6}, date: 2022-11-27 21:53:11 +0000))

Info 2022-11-27T21:53:11Z
[ENA/RiskProvider.swift:532] [updateActivityState(_:)]
RiskProvider: Update activity state to: idle

The error 13 rate limit is accurate because also failed checks counting into the rate limit. The device tries in the background to check and fails and used quota of the rate limit. The error 13 is shown to the user if 48 no succes exposure check was possible

commented

@thomasaugsten But where does ENError 16 come from?

commented

We had a discussion about this in #3970 (comment), where @ndegendogo described the same problem. Is it known when the ENF throws error 16 (my device had not been restarted IIRC)?

https://developer.apple.com/documentation/exposurenotification/enerror/code/datainaccessible
The error should occur if the device is not unlocked after restarting the device. But we see this error happens without no reason. The recommendation was to ignore the error.

commented

@thomasaugsten But failed risk checks with ENError 16 seems to count into the rate limit, which then leads to error 13, so ignoring the error is not really possible as it can cause other errors. For normal users, things like this can become a real problem, as they are likely to not open the CWA as regularly as I do.

Can you tell from the logs whether a dead man notification was scheduled? I can't remember if there was one, sorry.

I don't think error 16 count into the rate limit. The reason is very likely not enough background time to do a exposure check. But we need a complete log for this

commented

@thomasaugsten What do you mean with "compelete log"? The full log for the timespan 2022-11-25 till 2022-11-28 is here: gist.github.com/Ein-Tim/d97d66e21852cfdf33e65ac1db963015

commented

@thomasaugsten Did you have time to check the log?

Yes but I have no explanation for this situation. I looks like the error 16 caused the rate limit warning. But anyway the deadman notification has to be shown to the user. What is the behavior of the device at the moment?

commented

@thomasaugsten

What is the behavior of the device at the moment?

Thanks for asking! I just checked, and the same issue appears again! Full log from 03.12.2022 - 07.12.2022 can be found here: https://gist.github.com/Ein-Tim/62f6c0f96b8d50a1ae3a51b91c14854d

It's again something with error 16. But the device was not restarted or left in lock state. I'm sure this time.
Maybe this is a device specific problem, that the device is in some sort of idle state and thus the risk check doesn't go through? Or it happens because of the logging, which takes too many background resources?
I don't have any issues on my iPhone XR. Let me know if I should test something.

Details: App shows Error 13, white risk card, last risk check on 04.12.2022 (02:49 Uhr).

commented

As the CWA project went into ramp-down mode, I don't expect this bug to be fixed anymore, if it is fixable at all from CWA side. I'm therefore closing this issue now.