visualize-admin / visualization-tool

The tool for visualizing Swiss Open Government Data. Project ownership: Federal Office for the Environment FOEN
https://visualize.admin.ch
BSD 3-Clause "New" or "Revised" License
31 stars 3 forks source link

Server crash due to suspected memory leak #977

Open dedcode opened 1 year ago

dedcode commented 1 year ago

The server was running normally, then suddenly crashed. A stack trace was generated, which suggests that there may be a memory leak. Unfortunately, I don't have further steps to reproduce it.

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x7f59c50b7b79]
    1: StubFrame [pc: 0x7f59c503e8e1]
Security context: 0x1c2a0fd1b9a1 <JSObject>
    2: extractBlockModulesMap(aka extractBlockModulesMap) [0x33744d47d71] [/home/ubuntu/storage/visualization-tool/node_modules/next/dist/compiled/webpack/bundle5.js:~77898] [pc=0x3c1493c887d0](this=0x2b84590404b1 <undefined>,0x1bf4fa6ab6e1 <Compilation map = 0x21cdf0487c39>)
    3: visitModules(aka visitModules) [0x3374...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x7f59c41f53cc node::Abort() [/lib/x86_64-linux-gnu/libnode.so.72]
 2: 0x7f59c412567c  [/lib/x86_64-linux-gnu/libnode.so.72]
 3: 0x7f59c45cae2a v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.72]
 4: 0x7f59c45cb1e4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/x86_64-linux-gnu/libnode.so.72]
 5: 0x7f59c477d509  [/lib/x86_64-linux-gnu/libnode.so.72]
 6: 0x7f59c478ddc6 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.72]
 7: 0x7f59c478ec12 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/x86_64-linux-gnu/libnode.so.72]
 8: 0x7f59c4790fbd v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.72]
 9: 0x7f59c4791029 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/x86_64-linux-gnu/libnode.so.72]
10: 0x7f59c4755d43 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/lib/x86_64-linux-gnu/libnode.so.72]
11: 0x7f59c4aab6e7 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/lib/x86_64-linux-gnu/libnode.so.72]
12: 0x7f59c50b7b79  [/lib/x86_64-linux-gnu/libnode.so.72]
Aborted (core dumped)
error Command failed with exit code 134.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ptbrowne commented 1 year ago

Thanks for reporting. This is unfortunate. What is the context of this deployment ?

  1. Is there instrumentation that can help know the amount of memory the server was using at the moment of the trace ?
  2. When did it crash ?
  3. What is the amount of memory available to the server ?
dedcode commented 1 year ago

Unfortunately no. Is there something I can activate to get a more detailed trace next time? Not sure when it crashed. For context there is no load, this is a test server to evaluate the platform. The amount of memory is 30GB

ptbrowne commented 1 year ago

Not directly in the application, it would be something to have as part of a metrics platforms like Grafana. How much time was it running ?

dedcode commented 1 year ago

Now the server crashes faster after starting: ~2 hours. I tried to log the memory. My server has 32G. Based on my memory profiling, there was still plenty of memory. 26-02 17:18:30 | 49   1  50   0   0 | 10.4G 3995M  619M 14.8G | 26-02 17:18:31 | 30   1  69   0   0 | 10.4G 3989M  619M 14.8G | 26-02 17:18:32 |  0   2  98   0   0 | 8563M 6038M  619M 14.8G | 26-02 17:18:33 |  0   2  98   0   0 | 7159M 7442M  619M 14.8G |