Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC c library versioning and leaks on the client side #50

Open
jamesthompson opened this issue Feb 22, 2018 · 7 comments
Open

gRPC c library versioning and leaks on the client side #50

jamesthompson opened this issue Feb 22, 2018 · 7 comments

Comments

@jamesthompson
Copy link

Firstly thanks a lot for this great work, we're really excited to be using it.

Recently we've been stress testing some services and have noticed what we think is some memory leakage in the underlying c code, but only on client requests (used from high level generated code), not seemingly on server handlers.

  • I'm planning on doing some profiling, but I'm not an expert on debugging c from haskell, any advice on how I might go about diagnosing if my theory is correct would be greatly appreciated.

Having had a cursory look at the grpc c-lib releases over the last year, it seems there's been a bunch of memory leak fixes (pretty much all releases actually).

  • We were wondering if there was any plan to try to upgrade this new core library to use the later c-lib versions?

I've just had a look at building this against v.1.8.3 but the c-api has changed a bit:

src/Network/GRPC/Unsafe.chs:228: (column 7) [ERROR]  >>> Unknown identifier!
  Cannot find a definition for `grpc_call_destroy' in the header file.
src/Network/GRPC/Unsafe.chs:145: (column 3) [ERROR]  >>> Function arity mismatch!
  Parameter marshallers are missing.

I'm not really au fait with the nuts and bolts of the low-level c interface, so I'm not sure I can immediately help in this endeavour, or indeed, if it might be desired at all.

Any comments from you folks on this would be greatly appreciated. Thanks in advance for reading and helping!

@Gabriella439
Copy link
Contributor

@jamesthompson: Just to clarify: you're saying that the server is stable memory-wise, but a long-lived client is not?

Also, I think you can run valgrind on a Haskell binary (I have not tried this in a very long time, though, so I could be wrong)

We do plan on upgrading to a newer grpc. It's something I'm slowly working on

@jamesthompson
Copy link
Author

@Gabriel439 That's correct, the server seems to run very happily with a small memory footprint, but long lived clients using withGRPCClient and the high-level generated code exhibits continually expanding memory consumption, despite there being multiple GC cycles (from an +RTS -s analysis).

I'll look into valgrind to see if I can get anything diagnosed.

@gbaz
Copy link
Contributor

gbaz commented Feb 22, 2018

One question is if you occasionally exit the withGRPCClient and reinitiate that, if that helps...

@CMCDragonkai
Copy link

Any news on this?

@Gabriella439
Copy link
Contributor

@CMCDragonkai: No news yet. I haven't had a chance to look into this and likely won't within the next month at least

@jamesthompson
Copy link
Author

@CMCDragonkai I haven't been using this library for a while now and have recently been trying out https://hackage.haskell.org/package/http2-client-grpc and associated libs to great success. Sorry I can't be of more help right now.

@CMCDragonkai
Copy link

@jamesthompson we were using that library and suffered from really slow streaming bandwidth.

RichardWarfield pushed a commit to litxio/gRPC-haskell that referenced this issue Apr 25, 2023
* Deterministically pin to a 17.09 nixpkgs

* Remove out-of-date cabal2nix output

* `proto3-wire` → `d492fa3`

* Fix shebangs for test scripts

* Remove test scripts patchfile

We no longer need to patch in this manner, as we will ensure that the correct
GHC is on the nix-shell $PATH.

* Don't barf on unset PYTHONPATH

* Relax `aeson` bound

* Simplify and cleanup toplevel nix

* rm `nixpkgs.json`

* Workaround High Sierra linking issue by restructuring ...

the `nix-shell` GHC vs. that used by `testHaskellDepends`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants