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: race condition on webrtc handler #496

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

Conversation

GyeongHoKim
Copy link

@GyeongHoKim GyeongHoKim commented Dec 5, 2024

Related to #497

Problem

My product is React WebAPP for GIS system, I use RTSPtoWeb as Media Server. My product's users sometimes create & close webrtc players in very short time.
When there are many traffics, I found some of cameras does not release its RTSP Connection with RTSPtoWeb server.
I fixed it and worked well in my product.

gin.Context Is Not Concurrency-Safe

gin.Context is not created each requests. Gin uses sync.Pool. so if there are many traffics, sometimes race condition happens.
you should use Copy method or just store params on new variables.

cCopy := c.Copy()
go func() {
    client add & client delete
}()

or

uuid := c.Param("uuid")
channel := c.Param("uuid")
go func() {
    client add & client delete
}()

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.

1 participant