Closed vgarvardt closed 6 years ago
Merging #328 into master will decrease coverage by
0.21%
. The diff coverage is0%
.
@@ Coverage Diff @@
## master #328 +/- ##
==========================================
- Coverage 41.47% 41.25% -0.22%
==========================================
Files 74 74
Lines 2486 2499 +13
==========================================
Hits 1031 1031
- Misses 1390 1403 +13
Partials 65 65
Impacted Files | Coverage Δ | |
---|---|---|
pkg/plugin/oauth2/mongodb_repository.go | 0% <ø> (ø) |
:arrow_up: |
pkg/plugin/oauth2/setup.go | 7.86% <ø> (ø) |
:arrow_up: |
pkg/router/listen_path_matcher.go | 100% <ø> (ø) |
:arrow_up: |
pkg/config/specification.go | 61.11% <ø> (ø) |
:arrow_up: |
pkg/api/mongodb_repository.go | 0% <0%> (ø) |
:arrow_up: |
pkg/web/options.go | 0% <0%> (ø) |
:arrow_up: |
pkg/proxy/register_options.go | 0% <0%> (ø) |
:arrow_up: |
pkg/proxy/register.go | 0% <0%> (ø) |
:arrow_up: |
pkg/web/provider.go | 0% <0%> (ø) |
:arrow_up: |
pkg/plugin/basic/mongodb_repository.go | 4.34% <0%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 75dd24e...4c9c3ba. Read the comment docs.
What does this PR do?
This PR solves the problem with memory leaking on each reouter reload. The problem was in the transport - each definition created own transport, and each launched infinite go-routine. The solution is the following: do not create transport for each route, reuse one from the registry instead (registry key is being built from transport parameters), and do not launch go-routine, let transport retire "keep-alive" connections using internal transport functionality.
In addition to this there are couple minor changes I did during issue investigation:
pprof
http handlers to private port, can be enabled only with command argumentsgopkg.in/mgo.v2
with community-maintained forkgithub.com/globalsign/mgo
- profiling shown that mongo stuff (like BSON-decoding) consumes quite a lot of resources for ~100 proxies loaded every second from MongoOne known issue is still not fixed - the way I discovered this memory leak issue is that
reflect.DeepEqual()
does not work properly when comparing current loaded from Mongo data in our environment. I'm in the process of investigation, but let it be in the next PR.