Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Superset memory leak #15132

Closed
chen-ABC opened this issue Jun 12, 2021 · 11 comments · Fixed by #23139
Closed

Superset memory leak #15132

chen-ABC opened this issue Jun 12, 2021 · 11 comments · Fixed by #23139
Labels
#bug:performance Performance bugs #bug Bug report need:community-volunteer Requires a community volunteer

Comments

@chen-ABC
Copy link

chen-ABC commented Jun 12, 2021

A clear and concise description of what the bug is.
After querying the same chart for a long time, the available memory continues to decrease until the system runs out of memory

Expected results

Recycle memory after querying the chart

Actual results

The available memory keeps decreasing

Screenshots

If applicable, add screenshots to help explain your problem.
I started a scheduler job to query chart
image

How to reproduce the bug

1.force refresh of the chart in Dashboard
2. use memory profile
image
3. see log

image
After many times
image

use gc.collect() at end line, But the memory is not reclaimed

Environment

  • superset version: 1.1.0
  • python version: 3.7.9
  • node.js version: 12.18.3
@chen-ABC chen-ABC added the #bug Bug report label Jun 12, 2021
@zhaoyongjie
Copy link
Member

zhaoyongjie commented Jun 13, 2021

Hi @chen-ABC. I also found this problem a long time ago when using incubator-superset in a production environment. My strategy is to restart the gunicorn process periodically. for instance:

gunicorn --max-requests 1024 ....
or
gunicorn --max-requests 1024 --max-requests-jitter 100 ....

refer to: https://docs.gunicorn.org/en/stable/settings.html#max-requests

@chen-ABC
Copy link
Author

chen-ABC commented Jun 13, 2021

@zhaoyongjie Thanks, This is useful for HTTP requests. but it has no effect on apscheduler job(Internal calls)

@zhaoyongjie
Copy link
Member

zhaoyongjie commented Jun 13, 2021

@zhaoyongjie Thanks, This is useful for HTTP requests. but it has no effect on apscheduler job(Internal calls)

The Superset only exposes an HTTP service, so I guess that it will work either way you call it(either external job request or common HTTP request).

@chen-ABC
Copy link
Author

@zhaoyongjie Thanks, This is useful for HTTP requests. but it has no effect on apscheduler job(Internal calls)

The Superset only exposes an HTTP service, so I guess that it will work either way you call it(either external job request or common HTTP request).

thanks, That's right

@zhaoyongjie zhaoyongjie added the #bug:performance Performance bugs label Jun 13, 2021
@chen-ABC
Copy link
Author

chen-ABC commented Oct 20, 2021

@zhaoyongjie
I think I found the cause of the memory leak.

 @utils.memoized(watch=("impersonate_user", "sqlalchemy_uri_decrypted", "extra"))
    def get_sqla_engine(

memoized use tuple key , The keys for the same query are different. Because there's an object in the key
image

I think we have the same problem in superset 1.3.0
example:
image

@villebro
Copy link
Member

Thanks for investigating this @chen-ABC ! I can try to repro and help get this fixed and released soon if this is indeed the culprit!

@zhaoyongjie
Copy link
Member

@zhaoyongjie I think I found the cause of the memory leak.

 @utils.memoized(watch=("impersonate_user", "sqlalchemy_uri_decrypted", "extra"))
    def get_sqla_engine(

memoized use tuple key , The keys for the same query are different. Because there's an object in the key image

I think we have the same problem in superset 1.3.0 example: image

Thanks a lot.

@junlincc junlincc added the need:community-volunteer Requires a community volunteer label Oct 27, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 17, 2022
@jhult
Copy link
Contributor

jhult commented Apr 20, 2022

It looks like PR #17319 is still open and needs to be merged.

@stale stale bot removed the inactive Inactive for >= 30 days label Apr 20, 2022
@zhaoyongjie
Copy link
Member

@jhult I will follow this issue recently.

@mdeshmu
Copy link
Contributor

mdeshmu commented Jul 7, 2022

I am also observing memory leak. We have auto dashboard refresh enabled. Memory keeps on increasing even though there aren't many active users.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug:performance Performance bugs #bug Bug report need:community-volunteer Requires a community volunteer
Projects
None yet
6 participants