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

On Mobile, tree details continuously refreshes or goes back to map. #133

Open
zoobot opened this issue Mar 7, 2023 · 17 comments
Open

On Mobile, tree details continuously refreshes or goes back to map. #133

zoobot opened this issue Mar 7, 2023 · 17 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@zoobot
Copy link
Member

zoobot commented Mar 7, 2023

Check on actual phone

@zoobot zoobot added bug Something isn't working help wanted Extra attention is needed labels Mar 7, 2023
@zoobot
Copy link
Member Author

zoobot commented Mar 7, 2023

@mwpark2014 Could this is related to commit 8b400b81b98dd107bd437c9a8b2757829601cbd7

Does it happen on your phone?

@mwpark2014
Copy link

mwpark2014 commented Mar 7, 2023

Ooh, sorry if this is me. I won't be able to fix until late tomorrow.

@mwpark2014
Copy link

mwpark2014 commented Mar 7, 2023

@zoobot I checked on my phone though. I'm not sure what the issue you are seeing is. For me, I don't see "continuously refreshes or goes back to map", but I run into a "Something went wrong while displaying this webpage" after staying on the tree details for a while, which is super weird

I can only repro this on my phone's chrome browser on android. Not on the mobile emulator in the chrome browser

@zoobot
Copy link
Member Author

zoobot commented Mar 7, 2023

Aww frustrating! I can't replicate it using dev tools on desktop. Maybe it has something to do with touch somewhere.

I'll look around at the Commits for changes to that as well.

@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

@mwpark2014 On dev I see "An error occurred. Please see console for more information" on my actual phone. I am going to try and go back through the commits until it stops failing.

@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

These ones seem fine

  • dcf4d6c - Update default stale time to 5 min (5 weeks ago)
  • 8b400b8 - Replace useEffect handling tree selection in MapLayout (#410) (5 weeks ago)
  • e31ba2b - Update README.md (#421) (5 weeks ago)

This one causes a refresh but don't see an error.

  • 0ffb5da - Get rid of updating query cache Tree vector data and tree db data is already being combined correctly in MapLayout (5 weeks ago)

@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

I tried reverting and it breaks onclick of the points.

@mwpark2014
Copy link

Check on actual phone

Can you share what phone and what browser you're using and steps to repro?

@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

iphone 12 & 5se
When scrolling to the bottom of the tree, it refreshes. Also the map refreshes randomly.
Sometimes it refreshes from the tree and goes back to the map.

@mwpark2014
Copy link

mwpark2014 commented Mar 8, 2023

This was first discovered yesterday, right? There was no indicator of this bug before? I connected my android phone using chrome browser to a local machine and I am able to repro the issue

Using https://waterthetrees.com/#pos=15/37.7207/-122.43923&id=4469999575224304
The local machine developer tools identified "potential out-of-memory crash", which explains why we don't see this on desktop. It takes 16 seconds to crash on my device. I wonder if it takes less time on less powerful devices.

image

Taking a deeper look into the code where this comes up

Update: Took a deeper look into the code. It doesn't look to be part of our codebase. I'm fairly certain that this is just general mapbox code that maps out points. Instead, let's focus on investigating what changes could have caused this issue to appear now

@mwpark2014
Copy link

Reproed the huge memory usage on desktop
image

Memory usage for this one tab (I'm 90% sure this is the wtt tab) spikes up and peaks at 2gb, then floats down to 1.5gb and settles. The pattern seems strange cause it's not a memory leak in that it's continuously leaking memory. Also need to be open to other potential sources of this bug including mapbox. Doesn't seem to be browser specific though

Going to test if it's related to the tree details container in particular and on desktop to isolate the issue.

@mwpark2014
Copy link

mwpark2014 commented Mar 8, 2023

Confirmed that this problem only occurs when the tree details container is open. It doesn't occur on the map without opening anything.
This happens on desktop and mobile even without the tree details container being open

Confirm that this memory issue exists on desktop too, but unlikely that desktop will crash due to higher RAM.
image

🤔 🤔 🤔

@mwpark2014
Copy link

mwpark2014 commented Mar 8, 2023

I think this is a back-end change. Do you know what causes these two loading phases @zoobot? I know this wasn't a thing before

Phase 1:
image
Phase 2:
image

Confirmed that the phase 2 of loading corresponds with the memory overload

@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

I think you are right, wtt_server is spiking on load

@mwpark2014
Copy link

Okay, cool. It's getting late, so I'll be hands off for now. I can be available late tomorrow night to help out if necessary.

Thanks for finding the issue! I've been thinking that we need to set up monitoring to be aware of these types of issues in the future more quickly automatically. Maybe set up some alarms. It's on my list but was a little further down in priority

@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

Thanks for your sleuthing on this!! I think you found the issue!

@zoobot zoobot transferred this issue from waterthetrees/wtt_front Mar 8, 2023
@zoobot
Copy link
Member Author

zoobot commented Mar 8, 2023

Temporarily fixes the cpu spike.

Need to deal with the tree-sources repo picking up all the trees modified in the db when the city is NOT in sources.
Better fix will be to add city and source at the same time as adding the first tree in a city.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

2 participants