"glib: Error creating thread: Resource temporarily unavailable\n\nvips2png: unable to write to target target\n",

I switched hosting providers and now in my new host I get this error

“glib: Error creating thread: Resource temporarily unavailable\n\nvips2png: unable to write to target target\n”,

is there anything I can change to fix this?

It was a image upload step after a few inserts

looks like it could be the image resize step throwing this error as my folder doesn’t get cleared either

Maybe you don’t have enough permissions for the web user to write to this folder.

I have the original upload file in the same directory of files and that part works great it also completes my first insert but then my next steps are 2 image loads and 2 image resizes then it clears a folder this is where it starts not completing as the original image should be removed n the 2 new sizes added

from what ive seen online it looks like I can either set a concurrent limit on the threads used by libvips (or whatever its called here not sure) or I need a better server with more threads available?

The host said it was my number of processes spiking on the action I have 50 allowed processes and can upgrade to 75 my old host could handle 150 but is 75 enough as 50 doesnt appear to be?

Any ideas before I upgrade server? Also what hosting does everyone use what allows nodejs cors ftp decent amount of processes etc

This is the first time I have heard of processes limits on hosting. Very weird.

But also how are you getting 50 processes running simultaneously?

What server model do you have php or nodej?

it’s a node js model and it seems to be related to resizing images as I removed the image load resize and save and it worked but my hoster said they ran tests and that the processes was hitting 70+ when ran

Just editing in there reply

We could find that your account has hit the process limit a few times, so it's certainly possible that's causing the "Resource temporarily unavailable" error, but the limit is 75 processes which are pretty high and glib alone is spawning 70+ processes at once. We were not able to find any logs related to this in the error log file.

Well for image resize we use the node sharp library and I see it does have some options to control the number of threads:

https://sharp.pixelplumbing.com/api-utility

Those can be also set with the environment variable: UV_THREADPOOL_SIZE

Seems to be a common thing in node:

So you might try to set this environment variable and restart the node server.

Hope it helps.

Thanks for the reply which file would this go in is there a config I should use or is there a specific js file? just don’t want to break anything Wappler side

this looks like the thread limit line

process.env.UV_THREADPOOL_SIZE = 25;

would I just add that to a certain file thanks for the patience :slight_smile:

No need to place that in a file.

Environment variables in node are usually set in the hosting control panel where you specify all the node properties.

Restarted node and still same error does this look right?

The variable name is just:

UV_THREADPOOL_SIZE

No need to prefix it with process.env that is only when used in js code.

I tried both using UV_THREADPOOL_SIZE with value 2 also throws the same error

Well that is about threads limits indeed, not processes as your hosting indicates.

No idea why processes might get spawned. The sharp image component uses system libvips indeed, so maybe your hosting should check what limits are exposed there.

What hosting do you use ive tried a few hosters now n keep getting a different issue per one do I need a vps cloud hosting shared etc? is it better if I convent the normal nodejs into a docker?

Well there are many recommendations in the #hosting-general category, check them out.