Why can't the memory be released even when there is no request?
See original GitHub issueHello, i have a few problems about splash. I wish i could get some help.
- It seems that about 1000 urls will cost more than 1GB memory, which cannot be released.
- The doc says the
/_gc
endpoint will run garbage collection. But in my trial, it doesn’t free the webkit memory. - After we set the
--restart=always
, once the splash shuts down and restarts, the requests coming in during that period all fail to get the content.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Memory is never released after https.get #8278 - GitHub
It's doing a get request, not POST request. The end shouldn't be needed. Even with or without the .end calls the memory is...
Read more >What REALLY happens when you don't free after malloc ...
-1 for "completely fine" It is bad coding practice to leave allocated memory without freeing it. If that code was extracted into a...
Read more >How to fix out of memory errors by increasing available memory
Step 1: Increase Available Memory · Increase Xmx in small increments (eg 512mb at a time), until you no longer experience the OutOfMemory...
Read more >How to troubleshoot Linux server memory issues - UpCloud
Proceed by turning off your server with the Shutdown request option on the left of the same page, and click OK in the...
Read more >How we find and fix OOM and memory leaks in Java Services
1. Understanding OOM errors and identifying their causes · The application needs more memory than the OS can offer. · The Java application...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this issue too. I found a work around by calling /execute rather than /render.html and pass custom lua script to close the rendered window. I believe render.html only load webpage and not closing it. This leads to memory leak. By forcing the window to close every time, it frees up the memory taken up. I did this and docker memory became very stable.
Here is the lua script I use:
function main(splash) local url = splash.args.url assert(splash:go(url)) assert(splash:wait(0.5)) local html = splash:html() splash:runjs(“window.close()”) return html end
Hope this helps 😃
_gc
calls everything I could find in qt API to clear caches, but it looks like sometimes this is not enough. If you want to handle restarts gracefully the way to go is to setup a load balancer (e.g. haproxy) which re-schedules requests to other instances if they are dropped. See e.g. an example config template here (it is not a config itself, it is a cookiecutter template).