Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Slow" background tasks never start #6292

Open
g123k opened this issue Jan 27, 2025 · 7 comments
Open

"Slow" background tasks never start #6292

g123k opened this issue Jan 27, 2025 · 7 comments

Comments

@g123k
Copy link
Collaborator

g123k commented Jan 27, 2025

Hi everyone (and more specifically @monsieurtanuki)!

I have an issue on my phone with 19 "slow background tasks".
The first one (not visible in the screenshot) was always in error, so I deleted it.

Now I have 18 slow tasks and they never start.
On screen changes, "fast" & "longHaul" are checked, but not "slow"-ed ones.
Is there any reason?

Image

@g123k
Copy link
Collaborator Author

g123k commented Jan 27, 2025

The faulty task is removed, but there's still this error 🤨

BackgroundTaskManager:	 Background task error
PathNotFoundException: Cannot open file, path = '/var/mobile/Containers/Data/Application/D04F519F-A039-48F0-89C0-AB8B6381E1F6/Library/Application Support/full_image_382.jpeg.cropped.jpg' (OS Error: No such file or directory, errno = 2)

Seems similar to #6283

@monsieurtanuki
Copy link
Contributor

Seems similar to #6283

Indeed. Could it be that our "friends" of apple changed again the location of their standard dirs?
A solution might be to store files in the database, in order to avoid that kind of jokes.

@monsieurtanuki
Copy link
Contributor

@g123k For the record this is what we already do about file dirs on iOS:

  static Future<Directory> getDirectory() async =>
      getApplicationSupportDirectory();

  /// Returns a "safe" [File] from a given [path].
  ///
  /// iOS sometimes changes the path of its standard app folders, like the one
  /// we use in [getDirectory].
  /// With this method we refresh the path for iOS.
  /// cf. https://github.com/openfoodfacts/smooth-app/issues/4725
  static Future<File> getFile(String path) async {
    if (Platform.isIOS) {
      final int lastSeparator = path.lastIndexOf('/');
      final String filename =
          lastSeparator == -1 ? path : path.substring(lastSeparator + 1);
      final Directory directory = await getDirectory();
      path = '${directory.path}/$filename';
    }
    return File(path);
  }

As you are fortunate enough to experience the bug, would you try to check if the named dir (/var/mobile/Containers/Data/Application/D04F519F-A039-48F0-89C0-AB8B6381E1F6/Library/Application Support/) does exist?

@g123k
Copy link
Collaborator Author

g123k commented Jan 29, 2025

Seems similar to #6283

Indeed. Could it be that our "friends" of apple changed again the location of their standard dirs? A solution might be to store files in the database, in order to avoid that kind of jokes.

It seems that files are lost when we relaunch the app (I've reproduced the issue).
Just to be sure: in the code, you never delete files on boot?

@monsieurtanuki
Copy link
Contributor

It seems that files are lost when we relaunch the app (I've reproduced the issue).

That would be an undesired new behavior.
You mean relaunch, no reinstall, right?

Just to be sure: in the code, you never delete files on boot?

I wouldn't see the point.

@g123k
Copy link
Collaborator Author

g123k commented Jan 29, 2025

Quick demo: the photo is gone when the app is restarted:
https://github.com/user-attachments/assets/28c8d5b3-f052-41a6-9829-87fbff421eed

The photo indicator is also displayed indefinitely.

@monsieurtanuki
Copy link
Contributor

@g123k Unfortunately I cannot watch your video.
You're in the best position to fix the bug as you can reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 💬 To discuss and validate
Development

No branches or pull requests

2 participants