cosmo icon indicating copy to clipboard operation
cosmo copied to clipboard

Memory leak during configuration update

Open flymedllva opened this issue 1 year ago • 8 comments
trafficstars

Component(s)

router

Component version

wgc version

controlplane version

router version

v0.82.1

What happened?

Description

When updating the router configuration using r.updateServerAndStart, memory consumption increases.

Enough N times, make the schema puller download and apply a new schema, each time a new schema is applied (they must be different) the memory consumption of the application increases.

This is especially noticeable on large schematics larger than 20 mb.

Steps to Reproduce

I made an example frequently updating the schema, after a few minutes of router operation the memory consumption increases even on a small schema

In order to reproduce, clone the repository and start the router

https://github.com/flymedllva/cosmo-memory-leak-during-configuration-update

cd router && make dev

Commit necessary to reproduce the problem: https://github.com/flymedllva/cosmo-memory-leak-during-configuration-update/commit/880955ebc9e0435e3d9c2dfed7faa3dfb57f56c9

Environment information

OS: 14.4 (23E214) Package Manager: npm Compiler(if manually compiled): go version go1.22.1 darwin/arm64

Router configuration

version: "1"

# General router options
graph:
  name: "production"
  token: ""

log_level: "info"
listen_addr: "localhost:3002"
playground_enabled: true
introspection_enabled: true
json_log: true
shutdown_delay: 15s
grace_period: 20s
poll_interval: 10s
health_check_path: "/health"
readiness_check_path: "/health/ready"
liveness_check_path: "/health/live"
router_config_path: "config.json"

cors:
  allow_origins: ["*"]
  allow_methods:
    - HEAD
    - GET
    - POST
  allow_headers:
    - Origin
    - Content-Length
    - Content-Type
  allow_credentials: true
  max_age_minutes: 5m

# Config for custom modules   
# See "https://cosmo-docs.wundergraph.com/router/custom-modules" for more information   
modules:
  myModule:
    # Arbitrary values, unmarshalled by the module
    value: 1

Router execution config

No response

Log output

No response

Additional context

Screenshot 2024-04-26 at 00 53 45

flymedllva avatar Apr 25 '24 22:04 flymedllva

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible. The roadmap is driven by our customers and we have to prioritize issues that are important to them. You can influence the priority by becoming a customer. Please contact us here.

github-actions[bot] avatar Apr 25 '24 22:04 github-actions[bot]

Hi @flymedllva please provide a reproducible example. We can't investigate with this little information. Waiting for your feedback!

StarpTech avatar Apr 30 '24 09:04 StarpTech

@StarpTech Enough N times, make the schema puller download and apply a new schema, each time a new schema is applied (they must be different) the memory consumption of the application increases.

flymedllva avatar Apr 30 '24 09:04 flymedllva

@StarpTech hi, I've updated the issue description with a handy example to reproduce the issue, have a look again

Thanks

flymedllva avatar May 03 '24 11:05 flymedllva

@flymedllva thank you. We'll take a look.

StarpTech avatar May 03 '24 14:05 StarpTech

Have you looked at this problem? Any news?

flymedllva avatar Jun 20 '24 12:06 flymedllva

Hi @flymedllva, it is on our list, but it is not our highest priority. Please consider https://github.com/wundergraph/cosmo/issues/756#issuecomment-2078248440. If this issue prevents you from making progress with WunderGraph, please consider becoming a customer. This allows us to put the necessary resources on this.

StarpTech avatar Jun 20 '24 15:06 StarpTech

Hi @flymedllva

Has this improved with the latest version?

Thanks

Aenimus avatar Sep 20 '24 20:09 Aenimus