monorepo icon indicating copy to clipboard operation
monorepo copied to clipboard

git proxy server running out of memory with badges

Open samuelstroschein opened this issue 1 year ago • 8 comments

Problem

Opening large repositories in the editor like https://inlang.com/editor/github.com/NiklasBuchfink/jitsi-meet can lead to out-of-memory errors.

Jun 20 11:46:09 AM FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

CleanShot 2023-06-20 at 11 52 28@2x

Reproduction

  • Unsure. Opening jisti-meet works for me but @NiklasBuchfink seemed to have triggered this bug by opening the repo.
  • But the logs in render.com can be checked https://dashboard.render.com/ (ignore "wrong inlang config setup failed")

Additional information

This issue is likely part of removing the isomorphic git express middleware and having a dedicated lisa/server.

samuelstroschein avatar Jun 20 '23 09:06 samuelstroschein

@samuelstroschein Request the following badge triggers this issue: https://inlang.com/badge?url=github.com/NiklasBuchfink/jitsi-meet

NiklasBuchfink avatar Jun 20 '23 10:06 NiklasBuchfink

@NiklasBuchfink Request the following badge triggers this issue: https://inlang.com/badge?url=github.com/NiklasBuchfink/jitsi-meet

Oh, I see. In that case, here's whats likely happening:

  • N Parallel requests for the large repository (300MB) badge hit the server
  • no badge is cached yet
  • the server tries to clone N times the large repository in parallel into memory to generate the badge
  • N > 5 comes down to 1.8GB of RAM + other tasks = exceeds memory.

This bug should be auto-fixed by lazy cloning of repos. The entire repo wouldn't get cloned into memory anymore. Massively speeding up the generation of badges, increasing cache hit chance, and reducing memory consumption.

@araknast really looking forward to lazy cloning/only download file contents on demand

samuelstroschein avatar Jun 20 '23 10:06 samuelstroschein

The future plan of project lisa foresees an unbundling of inlang.com and the git proxy server. A crash in a lisa server won't take down inlang.com anymore.

samuelstroschein avatar Jul 31 '23 14:07 samuelstroschein

@NiklasBuchfink @samuelstroschein Whats the status on this issue? Will @inlang/lix handle this? Who should be assinged?

felixhaeberle avatar Sep 12 '23 10:09 felixhaeberle

@felixhaeberle this will be one of my immediate next tasks and i allready started looking into it, first step split up the systems, second step fix possible memory issues with proxy server

janfjohannes avatar Sep 12 '23 11:09 janfjohannes

related https://github.com/inlang/monorepo/issues/1334

felixhaeberle avatar Sep 14 '23 13:09 felixhaeberle

@janfjohannes one month later, status? 😄

felixhaeberle avatar Oct 13 '23 08:10 felixhaeberle

@felixhaeberle the full fix for this is the lazy loading lix feature, martin shared a loom today with the current progress on this front. the planned timeline is attached, please note, that it will be probably be a week later or so as the editor changes and edge cases to work with the github app/ new oauth scope logic were a bit more fiddly than in the project roadmap:

Screenshot 2023-10-14 at 01 00 45

janfjohannes avatar Oct 13 '23 22:10 janfjohannes

closing as stale/likely a duplicate in linear

samuelstroschein avatar Apr 06 '24 00:04 samuelstroschein