Problems with saving and loading generators on Perchance

Recently I was hit by the problem where the saving process just stuck in the background, and when I checked the DevTools Network, there’s a lot of stalled connections when fetching a few resources required for the generator page to fully load. The stall eventually ends for a short time (1-30 min), but sometimes even longer (30-60 minutes), and even after that, it’s either still hangs on “saving” whatsoever, or it rolls back to the perviously “unsaved” state.

I also got the problem with loading generators too, where it hangs very frequently now, for the same reason, except that I sometimes get an ERR_QUIC_PROTOCOL_ERROR from the console whenever the generator fails to load after the stalled connections.

Is this maybe just because of the internet connection, my browser, or probably the “cache-busting” issue in the end? I tried logging into my other browser (Firefox) and saving the same generator and found no issues. It also loads generators perfectly fine.

BluePower,
@BluePower@sh.itjust.works avatar

Alright, that just happened again recently. Here’s a few more screenshots. The Complete the Number Blocktrains one indeed didn’t save as it still stuck on the saving process, well, until I pressed the reload button at the bottom of the preview panel.

https://sh.itjust.works/pictrs/image/b21f5905-5552-48c4-9918-3903e52088a9.png

https://sh.itjust.works/pictrs/image/41b69ebf-44f1-4b6a-aef0-715ca3133bff.jpeg

https://sh.itjust.works/pictrs/image/a580c102-d080-4bc8-a0d3-d65d40398227.png

Also pinging dev @perchance

perchance,

Thank you for collecting those screenshots! Looks like you had to wait quite a while to capture that, and it’s very useful in working out what’s going on here.

That said, I certainly haven’t got to the bottom of this. This SO answer: stackoverflow.com/a/29564247/11950764 says:

Stalled/Blocking: Time the request spent waiting before it could be sent. This time is inclusive of any time spent in proxy negotiation. Additionally, this time will include when the browser is waiting for an already established connection to become available for re-use, obeying Chrome’s maximum six TCP connection per origin rule.

Which seems to indicate that there may be other connections (possibly in other tabs?) which are somehow taking a really long time, and so are “hogging” all the connections that Chrome will allow to perchance.org Would be interesting to note how many Perchance tabs are open when this next occurs - to see if it’s more than ususal.

One thing I did noticed is that you still have lots of singular requests to the generatorStats API on your generator manager:

https://lemmy.world/pictrs/image/264aa645-0ae6-4deb-b120-723f4f8cc8f5.png

I posted a reply to one of your comments at some point about using the API to get a bunch of stats with a single request, like this:


<span style="font-weight:bold;color:#a71d5d;">let </span><span style="color:#323232;">generatorDataArray </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">await fetch(</span><span style="color:#183691;">"https://perchance.org/api/getGeneratorStats?names="</span><span style="font-weight:bold;color:#a71d5d;">+</span><span style="color:#323232;">generatorNameArray.join(</span><span style="color:#183691;">","</span><span style="color:#323232;">)).then(r </span><span style="font-weight:bold;color:#a71d5d;">=> </span><span style="color:#323232;">r.json());
</span>

Example: perchance.org/generator-list-with-stats-2-templat…

Not sure if that’ll help, but it might be worth a shot.

Strange that it works fine in Firefox though. I wouldn’t rule out it being a problem with the Perchance server, because traffic has been increasing, so weird scaling problems can arise. I also see ERR_QUIC_PROTOCOL_ERROR sometimes, and I’ve tried to look into it, but to no avail. I’ll keep an eye on this and try to keep digging into potential causes. If you get any other clues (like that it doesn’t seem to be an issue on Firefox), I’d be glad to hear about them.

BluePower,
@BluePower@sh.itjust.works avatar

Yeah, the TCP connections limit makes more sense now. I don’t have any time to find out the cause, but I suspect that’s the issue.

perchance,

I just fixed a bug with the saving process that was causing infinite “saving…” in some situations. Not sure if it’s related, but if you don’t see this problem again, then this bug fix was probably the reason.

BluePower,
@BluePower@sh.itjust.works avatar

Thanks! I’ll check it on my PC later.

BluePower, (edited )
@BluePower@sh.itjust.works avatar

One thing I did noticed is that you still have lots of singular requests to the generatorStats API…

Yeah, I know that and actually have been using it to calculate the total views thing, but the repetitive generatorStats requests isn’t necessarily a major problem anyways, but I think I’ll need to use that alternative technique to retrieve the generator stats for each of the generators there, I suspect that was a repetitive call of the generatorStats API for every generator item in the hub.

And from this, I just got one suggestion for the generator-stats-plugin: What if you could do the same technique that you mentioned earlier within the plugin itself, those data you can then pass it through a variable, for example:


<span style="color:#323232;">genStats </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">[generatorStats(</span><span style="color:#183691;">"power-name"</span><span style="color:#323232;">, </span><span style="color:#183691;">"power-hangman"</span><span style="color:#323232;">, </span><span style="color:#183691;">"power-input-twister"</span><span style="color:#323232;">, </span><span style="font-weight:bold;color:#a71d5d;">...</span><span style="background-color:#f5f5f5;font-weight:bold;color:#b52a1d;">)</span><span style="color:#323232;">]
</span>

And then, when you want to retrieve these data:


<span style="color:#323232;">The Power Name Generator has been viewed [genStats[</span><span style="color:#183691;">"power-name"</span><span style="color:#323232;">].views] times and was edited [genStats[</span><span style="color:#183691;">"power-name"</span><span style="color:#323232;">].lastEditTime].
</span>

With that, everyone and not only me can use the names technique just by using the plugin. And thanks for the more descriptive explanation on the “connection stall” problem! 😊

  • All
  • Subscribed
  • Moderated
  • Favorites
  • perchance@lemmy.world
  • ethstaker
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • ngwrru68w68
  • cubers
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • cisconetworking
  • mdbf
  • kavyap
  • Durango
  • megavids
  • khanakhh
  • GTA5RPClips
  • anitta
  • osvaldo12
  • everett
  • normalnudes
  • tester
  • tacticalgear
  • provamag3
  • modclub
  • Leos
  • JUstTest
  • lostlight
  • All magazines