Fix trace client memory leak#6856
Conversation
|
@crwilcox please help us to submit this and do a patch release if possible. Thank you |
|
@c24t Thanks for this ! This might actually fix some issues we've been running into where 'too many open files' exceptions crash our VM. Those start occurring because we keep creating new clients / new connections. |
|
When we debug this issue we saw also socket objects being leaked, so I think it is a correlation. |
tseaver
left a comment
There was a problem hiding this comment.
Thanks for the patch! We need test coverage for the case that the backing variable is already set, in both the v1 client unit tests and the v2 client unit tests. The new test would look something like:
def test_trace_api_existing(self):
credentials = _make_credentials()
client = self._make_one(project=self.project, credentials=credentials)
client._trace_api = mock.sentinel.trace_api
self.assertIs(client.trace_api, mock.sentinel.trace_api| """Check that the client caches _trace_api.""" | ||
| client = self._make_one(project=self.project, | ||
| credentials=_make_credentials()) | ||
| self.assertIsNone(client._trace_api) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Thanks for bearing with me, @c24t! |
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter. We fixed the leak in googleapis/google-cloud-python#6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10). With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter. We fixed the leak in googleapis/google-cloud-python#6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10). With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter. We fixed the leak in googleapis/google-cloud-python#6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10). With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter. We fixed the leak in googleapis/google-cloud-python#6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10). With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
Enables tracing in the email and recommendation services, which was disabled in 316db88 because of a memory leak in the stackdriver exporter. We fixed the leak in googleapis/google-cloud-python#6856. The fix is included in the [0.1.10 release of opencensus-python](https://github.com/census-instrumentation/opencensus-python/releases/tag/v0.1.10). With this diff, traces show up as expected in stackdriver while running the demo on GKE. Using an `opencensus-python` package version before `0.1.10` causes the email and recommendation services to leak memory until they OOM. Memory use is back to normal (i.e. roughly constant) using the new package version.
cc @liyanhui1228
@bogdandrutu and I are seeing a persistent memory leak in projects using the opencensus stackdriver exporter, which uses
google.cloud.trace.client.Clientand repeatedly callsbatch_write_spans.Reusing the trace client's API object fixes the leak.