Skip to content

method cache and memory leaks #175

Closed
@terion-name

Description

@terion-name

I have a specific usecase where schemas are not static, but should be updated over time without entire app restart.

In short, I have a master express server (that handles task-specific routing for SaaS system), that spawns child apollo-express servers (each for corresponding subsystem), that each use complex schemas built with graphql-binding over underlying microservices.

When something in subsystem's microservices updates I nee to rebuild it's schema. So I delete from memory corresponding apollo-express server and it is rebuilding (and new graphql-bindings are generated).

After each rebuild a manually call garbage collector. As of bindings do exist only in context of apollo-express server, deleting this server should terminate all references to graphql-bindings and GC should free memory of them.

But I encounter a problem with graphql-bindings method cache — it is not cleared when bindeings are deleted. After every update method cache grows and grows:

api-gateway____freelance_freelance__1991_dobre_dosvit_core_api-gateway__-_____src_lib_subscribetoevents_js__api-gateway_

  1. It shouldn't act like this in general, method cache should be bound to concrete Binding instance to be cleared, when this instance is deleted
  2. As for now, is there a way to manually clear method cache?

UPD
As I see from here https://github.com/graphql-binding/graphql-binding/blob/master/src/Binding.ts - no, there is no access to this cache map :(
Using such global static and unreachable cache is a design flaw, IMO

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions