question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why can't the memory be released even when there is no request?

See original GitHub issue

Hello, 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:open
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
PornthipSaechongcommented, Apr 6, 2017

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 😃

1reaction
kmikecommented, Aug 12, 2016

_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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found