JohanDegraeve / xdripswift

xdrip for iOS, written in Swift
GNU General Public License v3.0
316 stars 310 forks source link

App sometimes hangs at fast rise (cont'd from #500) #510

Open robster7674 opened 3 months ago

robster7674 commented 3 months ago

This is a continuation of https://github.com/JohanDegraeve/xdripswift/issues/500, which was recently closed.

Last night around 20:50/20:55 I thought to myself: "I haven't heard a reading for a while now.". Indeed, when I looked at the old iPad I use as permanent monitor, it did not show a value anymore. Starting the Xdrip app on my iPhone resulted in seeing a high alert instead of the normal application screen.

Looking at the log files, I noticed this when filtered for "error":

2024-03-23 18:45:53.2050 5.0.2 4193 PlaySound                      in playSound, could not set AVAudioSession category to playback and mixwithOthers, error = De bewerking kan niet worden voltooid. (OSStatus fout 1936290409.)
2024-03-23 18:58:53.1530 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 19:11:20.7040 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 19:15:27.5640 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 19:35:32.0440 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 20:47:44.9560 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 20:50:31.9920 5.0.2 4193 NightScoutUploadManager            failed to upload, error = Time-out van het verzoek.
2024-03-23 20:50:47.0520 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 20:52:35.9740 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.
2024-03-23 20:56:29.8350 5.0.2 4193 BlueToothTransmitter               error: The connection has timed out unexpectedly.

Nothing obvious to me. Connection timeouts I think can be explained by me being out of range from my iPhone. The AVAudioSession error is self-explanatory: siriIsRecording (see https://developer.apple.com/documentation/avfaudio/avaudiosession/errorcode/siriisrecording). Note: I think it would be a useful improvement to have the AVAudioSession.ErrorCode translated from its numerical value.

However, I also noticed this pattern twice in xdriptrace.0.log, which kind of struck me as odd (and the timing matches pretty well):

2024-03-23 20:40:27.1350 5.0.2 4193 AlertManager                   in checkAlert, snoozing alert high for 5 minutes
2024-03-23 20:40:27.1410 5.0.2 4193 AlertManager                   in checkAlert, raising alert high

2024-03-23 20:45:33.2530 5.0.2 4193 AlertManager                   in checkAlert, snoozing alert high for 5 minutes
2024-03-23 20:45:33.2630 5.0.2 4193 AlertManager                   in checkAlert, raising alert high

Is it expected to see snoozing for and raising of an alert in the same tenth of a second? Could this be a race condition that causes the behavior I observed? Next time I will try to get a screen recording when starting the app, to show what is happening - in case it's not completely clear.

xdriptrace.0.log: xdriptrace.0.log