Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.4k stars 1.98k forks source link

Start: Blank page caused by IndexedDB state #64756

Open ebinnion opened 2 years ago

ebinnion commented 2 years ago

Quick summary

I noticed that when I was logged in to my account and then went to /start that I got a blank page. Further, when I went to the sidebar in my sites and clicked to "Add new site" I got a similar blank page.

After debugging, it appears that the issue was something in the signup IndexedDB value. I was able to "fix" the state by deleting the signup key and then trigger the issue again by adding the same value into that key.

See Slack for the state of that key. I can also share a snippet that I used to set the IndexedDB state.

p1655499865537459-slack-C02FMH4G8

Steps to reproduce

This one was a bit weird to reproduce. The steps that I took are:

  1. Go to WordPress.com
  2. Set the state for the signup key. You'll likely need to make adjustments for your own sites and/or user ID
  3. Go to /start/domains
  4. Ensure that you see a blank page
  5. If you don't see a blank page immediately, set the value again. Production seemed relatively easy to reproduce on. Development was pretty difficult to reproduce on.

In the days before this, the only thing new that I had done was migrate a self-hosted Jetpack site on Pressable to Atomic (eric.blog) and then I also migrated the eric.blog domain to be associated with the new cache site on WPCOM.

What you expected to happen

No blank page.

What actually happened

Blank page.

Context

No response

Simple, Atomic or both?

No response

Theme-specific issue?

No response

Browser, operating system and other notes

No response

Reproducibility

No response

Severity

No response

Available workarounds?

No response

Workaround details

No response

griffbrad commented 2 years ago

@Automattic/team-calypso-frameworks Let’s take a look at this one. I don’t think it’s related to the core state persistence support in Calypso. It’s likely something specific about the way that persisted state is being handled in these flows, but we may be able to provide some insight into how these types of errors can be avoided going forward.

tyxla commented 2 years ago

Haven't looked yet, but at a first glance, this looks like a case where we're not leveraging persistence properly. Many of our reducers rely on persisted state but declare a schema for the data, and if the local data doesn't comply, it's thrown away. Looks like declaring and leveraging a schema for the signup state tree should do the job.

tyxla commented 2 years ago

Took another quick look, and made a few observations - sharing here, in case they can be useful for whoever ends up further investigating:

I'm assuming that what's going on here is either:

In any case, I'd recommend after getting to reproduce it, looking out for any errors that could hint as to where it's failing. If there are none, we're likely swallowing the error. In that case, the step it fails on could be a good hint on where to start. To debug this, I'd suggest debugging at where we actually load and store persisted state - respectively:

https://github.com/Automattic/wp-calypso/blob/d179ad30ca0f8f80720a993cafb4bc0fa6628b6f/client/state/persisted-state.js#L15

and

https://github.com/Automattic/wp-calypso/blob/d179ad30ca0f8f80720a993cafb4bc0fa6628b6f/client/state/persisted-state.js#L34

and comparing whether the data before serialization matches the data after loading the persisted state. I'm assuming they won't match, and the place where they don't match should hint at where the culprit could be.

@griffbrad @ebinnion I think it makes sense for folks who are more familiar with the signup flows to further debug this (perhaps @Automattic/martech-decepticons ?) but I'm also happy to provide further support to anyone who needs it - let me know.

jamiepalatnik commented 2 years ago

📌 HOUSEKEEPING

📌 SCRUBBING

📌 ACTIONS

cometgrrl commented 2 years ago

@Automattic/martech-decepticons Y'all were flagged in Slack as possibly being the right team to look into this one. Is that correct?

cometgrrl commented 2 years ago

Lowered priority to normal since we don't have clear repro steps and we only have one report.

gmovr commented 2 years ago

May or may not be helpful, but x-posting just in case :)

I also had this today, and it was related to p1658245766758849-slack-C096PD42U. I thought I fixed it for myself by clearing Memcache, and clearing indexed DB.

But after making a new site, the next time I went to /start it would do the same thing.

In my case I looked in Kibana for my user, and I it was errors from my sandbox (more context in the Slack above).

lsl commented 1 month ago

Recent report here p1722212069911599-slack-C02FMH4G8 - at least in terms of similar outcome.

I don't know whether the original report in this PR is still relevant but we could start by re-trying the snippet from Eric in the slack thread here: p1655499865537459-slack-C02FMH4G8

Aside from that, if there is some kind of unexpected and silent error happening that leads to the wsod being shown lets try to both log the error's and show the user/HE's something meaningful that we can trace better.

Done here means:

davemart-in commented 2 weeks ago

Moving to "needs more info"