Skip to content

Kestrel dies because of Out of Memory exception #4731

@HassanHashemi

Description

@HassanHashemi

One of our MVC projects keeps growing memory, and it seems that Garbage collector dose not do anything with it.

The process keeps growing until it is killed by the OS.

dmesg outputs this log:

[961030.365411] Out of memory: Kill process 3673 (dotnet) score 913 or sacrifice child
[961030.365725] Killed process 3673 (dotnet) total-vm:29592364kB, anon-rss:3565416kB, file-rss:256kB, shmem-rss:0kB

What makes me think that it is related to, GC not working as expected is that, i have periodically called GC.Collect() and memory immediately drops down significantly but still keeps growing in a much slower pace.

Also GC is running under Server mode.

Environment Info

Runtime: .Net Core 2.1
ASP.NET Core 2.1
Web server: Kestrel (directly exposed)
OS: Centos 7

4 Core processor
4GB Memory

Also not sure if it any how related, i thought maybe GC dose not recognize memory limits, so here is the output of ulimit command:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 15062
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 15062
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Notes

Update
Adding entire dmesg log here as gist to keep things clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestrel

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions