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

[core] Disconnect dead sockets from the multiplexer to free unused resources #1829

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ethouris
Copy link
Collaborator

@ethouris ethouris commented Feb 23, 2021

Fixes: #1822

  1. Refax.
  2. Added removal from multiplexer at the moment when the socket is moved to m_ClosedSockets. As the remaining activities are still pending, the socket should stop using the multiplexer, and if it was the last user of the multiplexer, the multiplexer will be deleted and will free the system UDP socket.

CONTROVERSY: The multiplexer ships also the m_pRcvQueue and m_pSndQueue objects that are pointer-copied into the CUDT structure. This might be then used by other threads, and the only lock that was observed to be guarding them is the m_ConnectionLock, which's range seems to be limited, and also this locks orders before m_GlobControlLock. The only collision observed so far in manual tests was that when closing the queue is used if there are set connection flags, so therefore additionally these flags are cleared. Not sure if this is enough to prevent the methods of CUDT class called from other threads to refer to m_pSndQueue or m_pRcvQueue. What is known is that likely at the time of moving the socket to ClosedSockets some of the methods executed in other threads might be in progress.

srtcore/api.cpp Fixed Show fixed Hide fixed
@ethouris
Copy link
Collaborator Author

ethouris commented Feb 3, 2023

All current attempts to fix this have failed. The current solution makes a hangup due to not cleaned up all socket resources.

@maxsharabayko maxsharabayko added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core labels Aug 5, 2024
@maxsharabayko maxsharabayko added this to the v1.6.0 milestone Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Not freeing system sockets when calling srt_close()
2 participants