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

NetworkNoRetryImageProvider throws uncaught error if tile could not be loaded #1387

Closed
5 tasks done
Chris1234567899 opened this issue Oct 19, 2022 · 11 comments
Closed
5 tasks done
Labels
blocked This issue's resolution can't be worked on right now feature This issue requests a new feature P: ∞ (won't add) This feature request won't be implemented

Comments

@Chris1234567899
Copy link

Chris1234567899 commented Oct 19, 2022

What is the bug?

When using a tile layer, but a tile could not be loaded (e.g. no internet connection), an uncaught error is thrown.

SocketException (SocketException: Failed host lookup: 'api.mapbox.com' (OS Error: No address associated with hostname, errno = 7))

Yes, I'm aware, I can deactivate
image
or click 10 times on continue, but that does not really solve the issue. Although the docs suggest people to build their custom tile providers, the default on should work out of the box.

What is the expected behaviour?

Don't break/interrupt the app and even more important: Since flutter treats it as uncaught exception, it is also spammed on Crashlytics.

How can we reproduce this issue?

Simply add a tile layer in a map and deactivate internet


TileLayer(
    urlTemplate: "https://api.mapbox.com/styles/v1/mapbox/satellite-streets-v11/tiles/256/{z}/{x}/{y}?access_token=${dotenv.get('MAPBOX_TOKEN')}",
    subdomains: const ['a', 'b', 'c'],
    errorTileCallback: (tile, error) {
        print(error);
    },
),

Do you have a potential solution?

No response

Can you provide any other information?

It looks like it's pretty much the same issue like
Baseflow/flutter_cached_network_image#336 (comment)

See also:
#593

Platforms Affected

All Platforms

Severity

Erroneous: Prevents normal functioning and causes errors in the console

Frequency

Consistently: Always occurs at the same time and location

Requirements

  • I agree to follow this project's Code of Conduct
  • My Flutter/Dart installation is unaltered, and flutter doctor finds no relevant issues
  • I am using the latest stable version of this package
  • I have checked the FAQs section on the documentation website
  • I have checked for similar issues which may be duplicates
@Chris1234567899 Chris1234567899 added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Oct 19, 2022
@JaffaKetchup
Copy link
Member

Hi @Chris1234567899,

I think it is perfectly acceptable and correct to throw an error here.
If flutter_map was to handle it, it would just have to throw it's own error. Alternatively, we could try to ignore this error: but then we might get questions from people that don't realise that they are offline, and that would be hiding an error - which is obviously not recommended.

My caching plugin has the same behaviour, so does the one you linked. The reason is that there's not really a good alternative.

It shouldn't crash the app, and you'll just have to ignore the error in Crashlytics. You can use your own tile provider and catch the errors if it really bothers you, or try adding an errorImage to your TileLayer.

Of course, if you have an alternative, please let us know. @ibrierley Do you agree with this?

@JaffaKetchup JaffaKetchup added P: ∞ (won't add) This feature request won't be implemented non-fatal and removed needs triage This new bug report needs reproducing and prioritizing labels Oct 19, 2022
@Chris1234567899
Copy link
Author

Chris1234567899 commented Oct 20, 2022

@JaffaKetchup
Thanks for your reply. Sorry but I think I have to disagree here.
On mobile phones we have often the situation that internet is not available or highly unstable, so it will happen frequently that some tiles cannot be loaded.

So in my opinion, it should be therefore the other way around: The default way should be no interruption/no uncaught error, and if some devs want to make a custom error feedback for the user, they already can do so through the parameters provided in the tile layer (error image + custom callback function).

PS. the errorImage param does not prevent flutter_map to throw an uncaught error, if that is what you meant. I would be happy if this would be the case.

@JaffaKetchup
Copy link
Member

Ok, for now I'll make it a feature request: it's not broken, it would just be better off changed.

I guess we can write errors to an output stream the user can optionally listen to, that might make sense.

@JaffaKetchup JaffaKetchup added feature This issue requests a new feature and removed bug This issue reports broken functionality or another error P: ∞ (won't add) This feature request won't be implemented non-fatal labels Oct 20, 2022
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Nov 20, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@betaWeb
Copy link

betaWeb commented Nov 28, 2022

Hello,

Same problem here, as I zoom in/out or pan, my console is spammed with the error SocketException: Failed host lookup: 'tile.openstreetmap.org' (OS Error: nodename nor servname provided, or not known, errno = 8), whereas the internet connexion works fine on the iOS simulator (and on my physical device).

Any leads to solve this ?

@ibrierley
Copy link
Collaborator

ibrierley commented Nov 28, 2022

Not quite sure from that if you want to fix the problem, or just suppress the error and which device that is on ?

@betaWeb
Copy link

betaWeb commented Nov 28, 2022

Not quite sure from that if you want to fix the problem, or just suppress the error and which device that is on ?

Both, but I don't think the connectivity issue comes from flutter_map (tell me if i'm wrong), so at least supress the error could be nice tho. It's on an iOS device (iPhone 13 pro max).

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@elliottetzkorn
Copy link

Hello,

Same problem here, as I zoom in/out or pan, my console is spammed with the error SocketException: Failed host lookup: 'tile.openstreetmap.org' (OS Error: nodename nor servname provided, or not known, errno = 8), whereas the internet connexion works fine on the iOS simulator (and on my physical device).

Any leads to solve this ?

I have this same error

@JaffaKetchup
Copy link
Member

I've realised that my suggestion in #1387 (comment) won't help: we still have to throw an error, even if we also call a callback or write to a stream.
Every ImageProvider, including the ones provided natively by Flutter have the same behaviour: there's just nothing else that can be done. Therefore, I'm closing this.

@JaffaKetchup JaffaKetchup closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2023
@JaffaKetchup JaffaKetchup added P: ∞ (won't add) This feature request won't be implemented blocked This issue's resolution can't be worked on right now labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This issue's resolution can't be worked on right now feature This issue requests a new feature P: ∞ (won't add) This feature request won't be implemented
Projects
None yet
Development

No branches or pull requests

5 participants