Skip to content

[Bug] Roads on web app on android not visible #548

Closed

Description

@codmitu

Description

I have this bug for a long time, sometimes its on sometimes its not. When i load the map multiple times or even a few times a day, the roads dissapear and i only see a blank field and rivers, buildings and everything else except the roads and alleys, and refreshing or restarting the app doesnt work. I am using google maps javascript api because its a browser app so this bug only occurs (i think) on android, on my laptop (windows chrome) everything looks fine, so i assume its a cache problem but i already tryed reinstalling, clearing data and cache and it didnt resolve the problem but in development i dont have this bug on windows chrome. The curious thing is that tomorrow it will work fine for a bit, like every day it resets and works until it doesnt. Clearing cookies from the chrome settings for the specific site might fix it apparently, but its just temporarily

Steps to Reproduce

Loading the map multiple times might cause the bug

Environment

  • Library version: 1.1.0
  • Google maps version: weekly
  • Browser and Version: chrome 129.0.6668.54
  • OS: android 12
  • react 18.2.0

Logs

No response

Activity

  1. codmitu commented on Sep 26, 2024

    @codmitu
    Author

    Forgot to mention that this bug occured when i had 3D buildings enabled, now i am using three.js objects while i have the buildings off on the 3D vector map

  2. usefulthink commented on Sep 26, 2024

    @usefulthink
    Collaborator

    Although I think it's unlikely this has anything to do with React and this library, I still love to have a look at that. If this only happens in combination with three.js / WebGlOverlayView, it might be related to some sort of problem with the GPU.

  3. codmitu commented on Sep 27, 2024

    @codmitu
    Author

    this morning the map wouldnt show the roads only the train tracks and pedestrian only streets marked with a black line
    Screenshot_20240927-092941.png

    So i tryed clearing the cache, data, cookies, and restarting the app many times, created a new account, but with no luck this time
    As seen in the image below im trying to render 3600 objects with three.js (const dummy = new THREE.Object3D();)
    Screenshot_20240927-093000.png

    i remember that when i rendered 289 objects i didn't had this bug but now (with 3600) sometimes when i load the map it either crashes my app showing only a blank page or a default 2D map (im guessing a raster type)
    Screenshot_20240927-094642.png

    In conclusion im going to try again to render max 300 objects and add/remove the objects based on the map bounds when user moves

    ... later it didnt even load the train tracks
    Screenshot_20240927-101504.png

  4. usefulthink commented on Sep 27, 2024

    @usefulthink
    Collaborator

    That all sounds like the GPU crashes during rendering for some reason. What are you using to render the three.js objects?

  5. codmitu commented on Sep 27, 2024

    @codmitu
    Author

    That all sounds like the GPU crashes during rendering for some reason. What are you using to render the three.js objects?

    const texture = new THREE.TextureLoader().load("/models/fog.jpg");
    const buildGeometry = new THREE.BoxGeometry(1, 1, 1);
    const buildMaterial = new THREE.MeshPhongMaterial({
    map: texture,
    depthWrite: true,
    transparent: false,
    opacity: 1,
    });

    buildMesh = new THREE.InstancedMesh(buildGeometry, buildMaterial, 4000);
    scene.add(buildMesh);

    const dummy = new THREE.Object3D();
    // adding position, scale
    dummy.updateMatrix();
    buildMesh.setMatrixAt(i, dummy.matrix);

    renderer = new THREE.WebGLRenderer()

    I have optimized the image and now has 727bytes instead of 6kb.

  6. codmitu commented on Sep 29, 2024

    @codmitu
    Author

    Same day yesterday I have updated the app showing ~267 objects but the map still wouldnt show the roads, even after clearing cookies, cache, data, reinstalling the pwa. The desktop version and the Edge browser on android was working fine.

    Today the pwa on chrome works fine with the 267 objects, so I'm guessing its a cache thing, after consulting chatgpt it appears that the memory usage of the threejs objects can clear the cache from the memory RAM, where the google maps tiles are cached so the threejs scene can use that fresh memory to render its objects

    "Conclusion
    Yes, high memory usage from rendering a large number of Three.js objects can cause the browser to free up memory by clearing cached resources, which may affect the rendering of Google Maps tiles, potentially causing elements like roads and train tracks to disappear. To prevent this, it's important to optimize your Three.js scene to minimize memory usage and monitor performance using the browser's developer tools.
    "

    In the docs it says there are known issues with map-caching https://visgl.github.io/react-google-maps/docs/api-reference/components/map#map-instance-caching

    So maybe it's not really a bug but maybe a method for optimizing the api to not be exploited by limiting the map-views.

    This thread can now be closed/stay open or moved somehwere else

  7. usefulthink commented on Sep 30, 2024

    @usefulthink
    Collaborator

    All right, I will move this over to the discussions section then.

    I saw you seem to be using your own THREE.WebGlRenderer so I'm curious, are you aware of the @googlemaps/three package? Or is the three.js stuff unrelated to the map and just happens to be on the same page?

    If it is indeed a GPU crash of some sort, it should be fixed by either restarting the browser (i.e. force-kill the chrome app and relaunch) or by restarting the device (if it is a really bad crash). Everything else shouldn't affect this at all.

    The disappearing roads would be worthy of a report as an issue in the google maps issue tracker here: https://issuetracker.google.com/issues?q=status:open%20componentid:188853&s=created_time:desc

    To clarify the 'map instance caching': The only purpose of that is to prevent your app from creating a ton of map-instances when a single one can do the job (for example, you close the map in an SPA and come back to the map later). React would normally destroy the map instance and create a new one when needed, and our caching will keep the google.maps.Map object around in memory so it can be remounted instead of creating a new one. This isn't persisted anywhere beyond memory, so a reload will always clear that cache.

  8. locked and limited conversation to collaborators on Sep 30, 2024
  9. converted this issue into a discussion #555 on Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions