wundergraph / cosmo

The open-source solution to building, maintaining, and collaborating on GraphQL Federation at Scale. The alternative to Apollo Studio and GraphOS.
https://cosmo-docs.wundergraph.com/
Apache License 2.0
741 stars 104 forks source link

Memory leak in introspection #1256

Open ZirgVoice opened 1 month ago

ZirgVoice commented 1 month ago

Component(s)

router

Component version

v0.121.1

wgc version

v0.67.0

controlplane version

-

router version

v0.121.1

What happened?

Description

When a constant introspection request is made, memory leakage occurs.

Steps to Reproduce

The simplest way is to open Apollo GraphQL Studio and enable Auto Update in the Connection settings. The sandbox will start sending an introspection request every second, and at that moment, you can observe a rapid increase in RAM usage. After disabling auto-update, the memory gradually clears up.

Environment information

FEDERATED_GRAPH_NAME=production
LISTEN_ADDR=0.0.0.0:3001
ROUTER_CONFIG_PATH=./config.json
METRICS_OTLP_ENABLED=false
PROMETHEUS_ENABLED=false
LOG_LEVEL=debug
DEV_MODE=true

Router configuration

cors:
  allow_origins: ["https://studio.apollographql.com", "http://gateway:4000", "https://localhost:4200"]
  allow_methods:
    - OPTIONS
    - GET
    - POST
  allow_headers:
    - Origin
    - Content-Length
    - Content-Type
  allow_credentials: true
headers:
  all:
    request:
      - op: "propagate"
        named: Authorization
telemetry:
  tracing:
    enabled: false
engine:
    minify_subgraph_operations: false

Router execution config

No response

Log output

No response

Additional context

No response

github-actions[bot] commented 1 month ago

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.

StarpTech commented 3 weeks ago

Hi @ZirgVoice, thanks for reporting. We'll take a look. Could you please share your router and execution config? Thank you.

ZirgVoice commented 3 weeks ago

Hi @ZirgVoice, thanks for reporting. We'll take a look. Could you please share your router and execution config? Thank you.

Here's the config.json, and I’ve already provided the router configuration. config.json