Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Fix memory leak in TokenTransport #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

distorhead
Copy link

Close token-demand response before making auth-and-retry.

Unclosed responses lead to unclosed sockets and to memory leaks in long running apps:

...
lrwx------ 1 root root 64 Mar 12 20:16 11 -> socket:[3213896]
lrwx------ 1 root root 64 Mar 12 20:16 110 -> socket:[3238100]
lrwx------ 1 root root 64 Mar 12 20:16 111 -> socket:[3238973]
lrwx------ 1 root root 64 Mar 12 20:16 112 -> socket:[3238317]
lrwx------ 1 root root 64 Mar 12 20:16 113 -> socket:[3239210]
lrwx------ 1 root root 64 Mar 12 20:16 114 -> socket:[3239321]
lrwx------ 1 root root 64 Mar 12 20:16 115 -> socket:[3239503]
lrwx------ 1 root root 64 Mar 12 20:16 116 -> socket:[3239643]
lrwx------ 1 root root 64 Mar 12 20:16 117 -> socket:[3238846]
...

Close token-demand response before making auth-and-retry.

Unclosed responses lead to unclosed sockets and to memory leaks in long running apps:

```
...
lrwx------ 1 root root 64 Mar 12 20:16 11 -> socket:[3213896]
lrwx------ 1 root root 64 Mar 12 20:16 110 -> socket:[3238100]
lrwx------ 1 root root 64 Mar 12 20:16 111 -> socket:[3238973]
lrwx------ 1 root root 64 Mar 12 20:16 112 -> socket:[3238317]
lrwx------ 1 root root 64 Mar 12 20:16 113 -> socket:[3239210]
lrwx------ 1 root root 64 Mar 12 20:16 114 -> socket:[3239321]
lrwx------ 1 root root 64 Mar 12 20:16 115 -> socket:[3239503]
lrwx------ 1 root root 64 Mar 12 20:16 116 -> socket:[3239643]
lrwx------ 1 root root 64 Mar 12 20:16 117 -> socket:[3238846]
...
```
kispaljr added a commit to nokia/docker-registry-client that referenced this pull request Nov 10, 2018
Merge of flant:fix-memory-leak, a.k.a. heroku#50
diafour pushed a commit to flant/addon-operator that referenced this pull request Mar 4, 2019
* Проблема с утечкой памяти в библиотеке для работы с docker-registry:
    * Создан PR в heroku/docker-registry-client: heroku/docker-registry-client#50
    * В antiopa на данный момент используется форк flant/docker-registry-client ветка master
* Из форка flant/docker-registry-client убрано добавление параметра TLSNextProto для http-транспорта и перенесено непосредственно в antiopa при инициализации docker-registry-client.
* Рефакторинг файлов docker_registry.go и registry_manager.go
    * DockerRegistryInfo перенесен в registry_manager.go
* Клиент DockerRegistry создается один раз на все время работы программы.
* Информация из имени docker-image извлекается один раз на все время работы программы, т.к. имя образа не меняется.
@jeffwidman
Copy link

jeffwidman commented Jul 24, 2022

Wasn't this resolved when #71 was merged? Although admittedly I prefer this implementation since it checked for the error...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants