worker exited with exit code 137
My serverless worker seems to get the error,
worker exited with exit code 137
after multiple consecutive requests (around 10 or so). Seems like the container is running out of memory. Does anyone know what could be the issue as the script runs gc.collect()
to free up resources already but the issue still persists.3 Replies
you made your worker go out of memoery
I am logging memory usage at the start and before the return, it seems like memory isn't getting cleared after requests are finished. Is this expected?
Scenario: 2 requests processed by a single worker
Request 1:
- [start] Memory usage: 10203.82 MB
- [end] Memory usage: 27672.66 MB
Request 2:
- [start] Memory usage: 27672.66 MB
- [end] Memory usage: 41805.31 MB
memory management is the job of the process, e.g. golang has built-in garbage collection, if your filling up memory between jobs, you must optimize to have it handle one job after another, otherwise cold starts are a nightmare if you want the container restarted after each job, that is possible if you want that approach, look into refresh_worker in our docs