Getting server errors 508 while loading assets (Phaser 3)

Are you referring to the number of 200 or the overall amount of requests and transferred data? (Since it is not a plain webpage but a web application purely in JS it has some more ressources.)
Where and how can I scan/trace these kind of information? Also are there any limitation descriptions/conditions for free accounts listed somewhere like hit limits etc. (could not yet find it, at least not within the description of the free hosting mentioned here?

Please read here

4 Likes

Thank you. Checked those entries. The only fix respectivly specific limit I could find was the max. of 50.000 hits/day which I certainly never reach (here it shows 98). So I am still not really aware of what might cause the issue between my app and the server. Biggest file for BG music is ~4MB hence the 5MB so should also be no issue IMO.
The 20 MB resources I cannot relate to anything. Is this heap usage on server or storage capacity on server? Also does not look like much to me.
Are there any stats, lists, etc. I can check at the hosting area to control my app’s access and ressource consumption? Or is there anything I can do to check an resolve this isssue?
Due to that problem usability of my app is really not very good.

Any hints what I can do here or need to change?

There is the Account Statistics section in the control panel that shows some graphs to tell how you are doing in terms of resource limits. But those graphs only show aggregates of usage per day, not really detailed information to debug specific issues. Premium hosting has more detailed information.

The graphs in general seem to be quite low, all I see is the Daily Entry Process Failure Graph having some bumps. Entry Processes are basically concurrent requests, so I really think the number of concurrent requests is what’s causing the 508 errors.

I do have a general idea on how the limits work but the exact thresholds are a closely guarded secret, which is also why the graphs are quite vague. So I cannot tell you the exact number of concurrent requests that are allowed.

6 Likes

Thank you. Then it seems there is not much I can do about since the requests are coordinated by the browser. I just tried to load the page again and it failed again. Seems the Account Statistics are not immediatelly updated since there is no bump shown in the Entry Process chart for today. So it is a secret what the limit of concurrent requests is?

The really strange thing is that always the same files create these errors, independent from the browser used… Weird.

If nothing else will help maybe I need to look for another hoster which is really unfortunate since I was quite glad when I found out about infinityfree.

It loaded fine for me, albeit taking almost 6 minutes

82 requests
7.1 MB transferred
16.9 MB resources
Finish: 5.9 min
DOMContentLoaded: 1.5 min
Load: 1.5 min

The only thing that failed is the audio file, but that is expected per browser settings


I would really recommend looking into paid hosting for this. Majority of free hosting providers use the same backend as InfinityFree (Meaning you would have the same issue), and those that have a different backend are probably not much better in terms of limits.

After all, free hosting is intended for website hosting, not game hosting, so the limits and such are quite restrictive when you are doing what you are trying to do.

6 Likes

Thank you! 6 min is really strange. If page loads fine it loads within a few seconds here on my laptop including the big sound file. As of now it is not (yet) a game but just a deck editor. Also thank you for testing and the background information regarding free hosting backends.

That’s because the files are already cached on your device. The first time it is loaded, the browser has to download all the assets, but then it saves them for later just in case you visit the site again.

4 Likes

No, here this is also with empty cache or when I use another browser where I never loaded the page before. Maybe depending on internet speed and bandwith.

Yes, the graph is not a live counter, it’s updated once per day with the data from the day before.

Correct.

5 Likes

That’s too bad.So there seems to be no chance for me to find out what the reason is behind my page/app regularly not loading.

If anybody has still some idea would be great!

When I had such problems (it’s been more than 1 year)
back then, like you, I had a dozen audio files for the game plus other resources

The main problem is that those files were loaded by javascript XHR (game loader - or some 3D engine)
and not ordinary HTML code
and then when they download so many files in a short period of time, the server revolts and throws out a 508

So… I simply had to sit down (15+ hours of work) and make an audio sprite from all those audio files
so that the script loads one audio file and not 10+ (aim for fewer REQs)
and then give instructions to the script to find a specific sound in that audio file when the game needs it
means at 0-3 sec = gun sound
from 3 sec to 5 sec play explosion etc.
of course, the times are in milliseconds…also 10 times of listening until I guessed the timing correctly
but after that, getting it all to work ? :roll_eyes: - that was the hardest part, and that’s where I lost the most time because I had to change hundreds of lines of code in various places and files
because the game was simply written to call/load a certain mp3 on a certain event and that audio player from the game then executed it, but it was just made for that and not to load an audio sprite and to load instructions from X file to find which separate sound is in that file… additional problems occurred when a sound needs to be played in a loop, etc… read the manual … commands, this and that…

To begin with, try to put all the resources you can into the sprite… images first (images sprite)
and the one in the symbols folder.

Later you can deal with the audio sprite


The goal would be that, if possible, the audio should also be short and of a small file size.
Or change the 3D engine that supports sprites and then start using such code.

It would also help if you had your own domain so then you can use Cloudflare
because then Cloudflare would take over some (or all) of the traffic.

Because your app has “a loader” that, if it doesn’t load all the files into the cache, doesn’t start what it should
and if the server does not give/serve it all the necessary files (one is enough for it to fail)
your loader throws an error in the console and stops because it encountered an exception - and you see it as not working.

10 Likes

An 508 error is this

Admin had told you about the limit.

Follow Oxy’s advice or upgrade to premium.

5 Likes

@Reth01

you have another option:

if that rendering engine and its loader support lazy load, then you can turn it on in “the config section”

or if you know javascript, write some “sleep” ( setTimeout) function and find the best place in the script where you will intercept the loading
and then say that, for example, after each requested file, wait 500ms or 1 sec

or after every 5 wait X time (harder to implement because you would have to count how many were loaded/requested)

of course, this will significantly increase the loading time of your app
but on the other hand, at least it shouldn’t be 508

8 Likes

Thank you @Oxy ! Will have a look into it. These are some good approaches.

@Frank419 Yes, admin told that limits are a secret so no chance to verify against them.

3 Likes

@Reth01

I noticed something else, which is that none of your JS is minified
especially phaser.js = 6.33MB which is huge

find here your version or the latest one that works correctly with your code

and then when you use a CDN
visitors will not load that “huge” file from the hosting but from the CDN (some other server) and thus will reduce the traffic on the hosting server

And definitely minify the other JS…


Besides, there is no need to call many JS files separately

instead, put everything in one JS file
and you have already reduced the number of REQs with it

just make sure you follow the order of the scripts you add so that it is the same as in your HTML
because sometimes the order is important.


It’s not just because of the 508
instead, when you optimize the code and reduce the number of requests you speed up your website and reduce unnecessary traffic for your visitors.
Because at that time (minus 10+ javascripts = minus 8MB) user can download 30+ cards (imgs)

8 Likes

Thank you! Really great hints (still very new to JS coding). Will use the CDN instead of the direct usage of the phaser.js (idea was to provide everything out of one hand).

As for the number of own JS files. Minimizing them I would only do for deployment. Are there any recommended tools or toolchains for such kind of things?

Also using several files instead of a single very big one is to get the code more structured (non-spaghetti). ATM I am transitioning from script-tags to import statements. But since the number of JS files is growing this will also lead to more requests I guess.

1 Like

You will hardly find a tool online that will allow you to enter such a large amount of code (6MB)

but for smaller things, you can use this JavaScript Minifier & Compressor | Toptal®
as far as I’ve used it, it seems smart enough and it didn’t cause any problems in terms of the code not working

and then you just create one JS file
and put other JS (minify…) from HTML inside (in order)
step by step (script by script)
and check if it works after each script you moved

definitely remember to clear the browser cache while you’re trying it out
so that pulls new files from that new JS and not from the browser cache (ex files / HTML).

Of course, but you can have all that locally - where will you have normal versions to make it easier for you to read, etc., or possibly modify something.

5 Likes

Oh, misunderstanding: Not for the phaser file - for my JS code.

Thank you!

This is what I meant: Having my files local structured and then trigger a deploy chain which processes them in the manner you mentioned so that in the end I will have one minimised file (so without doing all the steps manually). Can be a local offlien toolchain too.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.