microsoft / pxt-arcade

Arcade game editor based on Microsoft MakeCode
https://arcade.makecode.com
MIT License
480 stars 207 forks source link

During localhost development, sometimes the filesystem workspace gets in a broken state #3017

Closed darzu closed 3 years ago

darzu commented 3 years ago

I've noticed occasionally on localhost while developing that this happens:

Screen Shot 2021-02-01 at 11 15 20 AM Screen Shot 2021-02-01 at 11 15 17 AM

And I can no longer access localhost MakeCode. Deleting "projects/" under pxt-arcade/ doesn't fix the issue.

I suspect this is triggered by some interaction with cloud sync.

eanders-ms commented 3 years ago

When I hit this, I've found I need to pass the whole url generated by pxt serve, including the local_token, e.g.: http://localhost:3232/#local_token=832758a8-162d-43de-33eb-480e62cf9f21&wsport=3233. Could you be hitting this?

jwunderl commented 3 years ago

^^ Eric's point is the typical cause of this, it gets cached on first load after a serve but if you go to another browser or private browsing window (partially dependent on settings) you need to make sure to grab it from the serve ~

darzu commented 3 years ago

Yes, in this case that doesn't work around the issue. I'm getting "500s" from the local server, usually if the issue is the missing local_token I see "403s" in the console.

darzu commented 3 years ago

Fixed here: https://github.com/microsoft/pxt/pull/7836/commits/c9bb1c0aea7d95ee4e2c5dbff87797081a0cd5d5

eanders-ms commented 3 years ago

I've noticed that any exception thrown out of a workspace api triggers a switch to memory. That might be too aggressive.

darzu commented 3 years ago

If we know it's a transient error, then yes, it's too aggressive, but if the workspace is failing in some significant way, the switch to memory seems like the best option.

IMO transient errors should be handled transparently underneath the workspace abstraction.

So I think the current behavior is appropriate actually.