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

fix: (c sshnpd) allocate threaded memory outside of the thread #1171

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

JeremyTubongbanua
Copy link
Member

- What I did

  • Allocated atkeys outside of the thread and are freed outside of the thread.

- How to verify it

new leak summary (after closing thread)

notice that the 585 bytes that were usually suppressed are no longer lost.

==28467== LEAK SUMMARY:
==28467==    definitely lost: 0 bytes in 0 blocks
==28467==    indirectly lost: 0 bytes in 0 blocks
==28467==      possibly lost: 272 bytes in 1 blocks
==28467==    still reachable: 121,622 bytes in 201 blocks
==28467==         suppressed: 0 bytes in 0 blocks

- Description for the changelog
fix: no longer lose 585B every time SSH session is established

@JeremyTubongbanua JeremyTubongbanua self-assigned this Jun 27, 2024
@JeremyTubongbanua JeremyTubongbanua changed the title fix: no longer lose 585B every time SSH session is established fix: (c sshnpd) no longer lose 585B every time SSH session is established Jun 27, 2024
@JeremyTubongbanua JeremyTubongbanua changed the title fix: (c sshnpd) no longer lose 585B every time SSH session is established fix: (c sshnpd) allocate threaded memory outside of the thread Jun 27, 2024
@JeremyTubongbanua JeremyTubongbanua marked this pull request as draft June 28, 2024 03:01
@JeremyTubongbanua
Copy link
Member Author

running into a 16 KB leak after establishing SSH connection, converting to draft while I investigate

@JeremyTubongbanua
Copy link
Member Author

After establishing an SSH session with 2 fresh atSigns, we get 16KB lost.

Threaded leak summary

==68541== LEAK SUMMARY:
==68541==    definitely lost: 16,384 bytes in 2 blocks
==68541==    indirectly lost: 0 bytes in 0 blocks
==68541==      possibly lost: 272 bytes in 1 blocks
==68541==    still reachable: 121,622 bytes in 201 blocks
==68541==         suppressed: 0 bytes in 0 blocks

Main process leak summary

==68485== LEAK SUMMARY:
==68485==    definitely lost: 16,384 bytes in 2 blocks
==68485==    indirectly lost: 0 bytes in 0 blocks
==68485==      possibly lost: 0 bytes in 0 blocks
==68485==    still reachable: 0 bytes in 0 blocks
==68485==         suppressed: 0 bytes in 0 blocks

Full valgrind logs: https://gist.github.com/JeremyTubongbanua/a49a783ea400506d871239873224d1a8

@JeremyTubongbanua
Copy link
Member Author

JeremyTubongbanua commented Jul 1, 2024

After establishing an SSH session with 2 fresh atSigns, we get 16KB lost.

Threaded leak summary

==68541== LEAK SUMMARY:
==68541==    definitely lost: 16,384 bytes in 2 blocks
==68541==    indirectly lost: 0 bytes in 0 blocks
==68541==      possibly lost: 272 bytes in 1 blocks
==68541==    still reachable: 121,622 bytes in 201 blocks
==68541==         suppressed: 0 bytes in 0 blocks

Main process leak summary

==68485== LEAK SUMMARY:
==68485==    definitely lost: 16,384 bytes in 2 blocks
==68485==    indirectly lost: 0 bytes in 0 blocks
==68485==      possibly lost: 0 bytes in 0 blocks
==68485==    still reachable: 0 bytes in 0 blocks
==68485==         suppressed: 0 bytes in 0 blocks

Full valgrind logs: https://gist.github.com/JeremyTubongbanua/a49a783ea400506d871239873224d1a8

The reason for this leak is at_c related. See atsign-foundation/at_c#328 for an upcoming fix.

Next commit will most likely be a commit hash change for atsdk so that the C Daemon will use the latest trunk hash for the memory leak fix.

@JeremyTubongbanua JeremyTubongbanua marked this pull request as ready for review July 2, 2024 16:08
@JeremyTubongbanua JeremyTubongbanua merged commit 41528be into trunk Jul 3, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants