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 with stream existence check #3309

Merged
merged 3 commits into from
Dec 12, 2024
Merged

Fix race condition with stream existence check #3309

merged 3 commits into from
Dec 12, 2024

Conversation

mjh1
Copy link
Contributor

@mjh1 mjh1 commented Dec 11, 2024

What does this pull request do? Explain your changes. (required)

In startTrickleSubscribe() we check the stream exists in LivePipelines but this is only set up inside startControlPublish() so I'm moving the initialise step above both these functions so there's no longer a race condition.

How did you test each of these updates (required)

Does this pull request close any open issues?

Checklist:

@github-actions github-actions bot added go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Dec 11, 2024
@mjh1 mjh1 requested a review from leszko December 11, 2024 14:18
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 34.03410%. Comparing base (abd997d) to head (97ee462).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
server/ai_process.go 0.00000% 2 Missing ⚠️
server/ai_live_video.go 0.00000% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3309         +/-   ##
===================================================
- Coverage   34.03772%   34.03410%   -0.00362%     
===================================================
  Files            141         141                 
  Lines          37006       37007          +1     
===================================================
- Hits           12596       12595          -1     
- Misses         23691       23693          +2     
  Partials         719         719                 
Files with missing lines Coverage Δ
server/ai_live_video.go 0.00000% <0.00000%> (ø)
server/ai_process.go 0.60711% <0.00000%> (-0.00053%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abd997d...97ee462. Read the comment docs.

Files with missing lines Coverage Δ
server/ai_live_video.go 0.00000% <0.00000%> (ø)
server/ai_process.go 0.60711% <0.00000%> (-0.00053%) ⬇️

... and 1 file with indirect coverage changes

events, err := common.AppendHostname(*resp.JSON200.EventsUrl, host)
if err != nil {
return nil, fmt.Errorf("invalid events URL: %w", err)
}
clog.V(common.VERBOSE).Infof(ctx, "pub %s sub %s control %s events %s", pub, sub, control, events)

params.node.LivePipelines[params.liveParams.stream] = &core.LivePipeline{}

startTricklePublish(ctx, pub, params, sess)
startTrickleSubscribe(ctx, sub, params)
startControlPublish(control, params)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I wonder if we can achieve the same effect by calling startControlPublish before startTricklePublish without having to change anything else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you're right that will work too, done 👍

@mjh1 mjh1 requested a review from j0sh December 11, 2024 19:51
@mjh1 mjh1 merged commit 77711d4 into master Dec 12, 2024
18 checks passed
@mjh1 mjh1 deleted the mh/race branch December 12, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues and PR related to the AI-video branch. go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants