flutter_map_tile_caching icon indicating copy to clipboard operation
flutter_map_tile_caching copied to clipboard

[BUG] I ocasionally get a PathNotFoundException in the FMTC initialization code

Open derTuca opened this issue 9 months ago • 2 comments

What is the bug?

We are using the following code to initialize FMTC.

    try {
      // FMTC only helps with local caching, the app should not crash when it cannot initialize, even if it should not happen.
      await FlutterMapTileCaching.initialise();
      await FMTC.instance('mapStore').manage.createAsync();
    } on Exception catch (fmtcError, st) {
      await Sentry.captureException(fmtcError, stackTrace: st);
    }

I randomly get error reports in Sentry with a PathNotFoundException with the following info for iOS devices:

PathNotFoundException: Cannot delete file, path = '/var/mobile/Containers/Data/Application/F1F8E4CC-B95A-4819-BE27-96E81BA8B87B/Documents/fmtc/.initialisationSafety.tmp' (OS Error: No such file or directory, errno = 2)

I am using flutter_map_tile_caching: ^9.0.0-dev.3. and have never used a non-Isar-based version if that matters. These reports get sent even when the app is not in the foreground, I'm not sure what is happening there.

How can we reproduce it?

I am honestly not sure what is the common thread between the devices. They are all iOS devices but not all iOS devices do this.

Do you have a potential solution?

No response

Platforms

iOS

Severity

Minimum: Allows normal functioning

derTuca avatar Sep 21 '23 14:09 derTuca

Hi @derTuca,

Some iOS devices are less stable than others. It's also random chance from when I've seen this before.

You can try disabling initialisation safety in the initialise call. It should be mostly safe to do this, as mobile only apps don't really run the risk of having their data modified externally (which would require safety). You could also just ignore it if it's not causing too many issues.

Hopefully the next version of Isar will have fixed small things like this. Focusing on FM at the moment (v6 coming soon), then hoping to get a new FMTC release within a month or two: there's a lot to do to improve stability and add features. There'll be a new FMTC prerelease for FM v6 asap after FM release.

JaffaKetchup avatar Sep 21 '23 14:09 JaffaKetchup

I'm pleased (and exhausted) to announce that the next (and hopefully final) prerelease is now available: https://pub.dev/packages/flutter_map_tile_caching/versions/9.0.0-dev.7. ObjectBox has finally arrived! A provisional CHANGELOG is available at https://pub.dev/packages/flutter_map_tile_caching/versions/9.0.0-dev.7/changelog#900---hundreds-of-hours---2024xxxx.

Some things to note:

  • #148
  • Importing functionality is not yet working
  • There is no gurantee for stability in this version: I have done basic testing only
  • There is little/no documentation available outside of what is in the code, including no migration info; I'll be happy to answer questions here, but some answers can be found in the CHANGELOG
  • No data from older versions will be available, but the databases will not be modified/deleted - check your storage space if necessary

I'm really eager to hear feedback. The number one thing I want to hear is that there are no(!?) crashes! But I also want to hear about bugs you've found. At this point, I cannot take further feature requests: I cannot afford the time to expand the scope of this further at the moment.

Please post feedback in #105.

JaffaKetchup avatar Mar 07 '24 21:03 JaffaKetchup