Skip to content

Website crashing due to memory leaks. #91

@JrtPec

Description

@JrtPec

Yesterday we succeeded in getting CSV's to generate from TMPO live on the website and send them to the browser. We however noticed that each request uses some memory and fails to free it afterwards. After a few requests the server unavoidably crashes.

We have tried following things to reduce memory load and free it up after the request, however none have really worked.

  1. Write a wrapper to close the file buffer after the request has completed. (link)
  2. Use a temporary file to store the CSV and serve it instead of using StringIO or cStringIO.
  3. Setting the Flask flag app.use_x_sendfile = True, to have nginx serve the file directly instead of the app. (I did not thoroughly test this, not sure of its effect)
  4. Deleting the Pandas DataFrame after the CSV is written, using del df
  5. Calling the garbage collector after the delete: import gc; gc.collect() (link)

Does anybody have other ideas we could try? The download page is live, but hidden under opengrid.be/download. The status quo is that it does work, however after a few runs it will crash the server, which then immediately restarts.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions