Skip to content

MoQ Stat gauge discrepancy corrections.#148

Open
akash-a-n wants to merge 1 commit intomainfrom
bugfix/moq-stats
Open

MoQ Stat gauge discrepancy corrections.#148
akash-a-n wants to merge 1 commit intomainfrom
bugfix/moq-stats

Conversation

@akash-a-n
Copy link
Copy Markdown

@akash-a-n akash-a-n commented Apr 16, 2026

moves moq_stat's onPublishDone to deliverPublishDoneAndRemove so that abandoned publisher are correctly decremented.


This change is Reviewable

Copy link
Copy Markdown
Author

@akash-a-n akash-a-n left a comment

Choose a reason for hiding this comment

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

@akash-a-n made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on afrind, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


moxygen/MoQSession.cpp line 1941 at r1 (raw file):

            onPublishDone,
            pendingPublishDone_->statusCode);
        auto token = cancelSource_.getToken();

When a publisher abandons a connection without sending a PUBLISH_DONE we leak an activePublisher count.
So emitting the stat here accounts for all publisher connections that ended without any double decrement risks.
It may not semantically sound right to use onPublishDone. I am happy to create a new MoQStat callback function if we are particular about that.

Copy link
Copy Markdown

@afrind afrind left a comment

Choose a reason for hiding this comment

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

If this is urgent we can cherry-pick it into release but would prefer we open an upstream PR.

@afrind reviewed 1 file and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on akash-a-n, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


moxygen/MoQSession.cpp line 1941 at r1 (raw file):

Previously, akash-a-n wrote…

When a publisher abandons a connection without sending a PUBLISH_DONE we leak an activePublisher count.
So emitting the stat here accounts for all publisher connections that ended without any double decrement risks.
It may not semantically sound right to use onPublishDone. I am happy to create a new MoQStat callback function if we are particular about that.

I see, we always deliver publishDone to the app even if we didn't receive one on the wire. It does feel slightly odd not to bump the counter on arrival, mabye this is ok.

I do think we should get this reviewed upstream, since MoQSession changes are likely to cause merge conflicts.

Also, it would be good to verify the changes here with a test.

Copy link
Copy Markdown
Author

@akash-a-n akash-a-n left a comment

Choose a reason for hiding this comment

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

I don't think this is urgent. We aren't displaying subActivePublishers_ for the demo are we? @peterchave

@akash-a-n made 2 comments.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on afrind, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


moxygen/MoQSession.cpp line 1941 at r1 (raw file):

Previously, afrind wrote…

I see, we always deliver publishDone to the app even if we didn't receive one on the wire. It does feel slightly odd not to bump the counter on arrival, mabye this is ok.

I do think we should get this reviewed upstream, since MoQSession changes are likely to cause merge conflicts.

Also, it would be good to verify the changes here with a test.

Added a test.

@peterchave
Copy link
Copy Markdown

I don't think this is urgent. We aren't displaying subActivePublishers_ for the demo are we? @peterchave

It was included in the overview dashboard, I have removed it for now.
Once the fixes are in, will overhaul the dashboards and review in detail.

omoq-sync-bot Bot pushed a commit that referenced this pull request Apr 25, 2026
…148)

Summary:
onWebTransportUniStream, onWebTransportBidiStream, and onDatagram all dereference clientSession_ without checking for null.  clientSession_ is reset in onSessionEnd, which fires when the proxygen session ends.  A race between the QUIC PeekLooper and ReadLooper can deliver WT stream or datagram callbacks after onSessionEnd has already nulled the pointer, causing a SIGSEGV.

Add null checks to all three callbacks so they are no-ops if the session has already been torn down.

Pull Request resolved: facebookexperimental#148

Reviewed By: sharmafb

Differential Revision: D102187697

Pulled By: afrind

fbshipit-source-id: 461e8cf8f4365ece5c4871cb97374a7b5f10006c
Copy link
Copy Markdown

@afrind afrind left a comment

Choose a reason for hiding this comment

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

@afrind reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on akash-a-n, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


moxygen/MoQSession.cpp line 1941 at r1 (raw file):

Previously, akash-a-n wrote…

Added a test.

Can you make a version of this PR in the upstream repo? I want to discuss with the other moxygen experts at meta

Copy link
Copy Markdown
Author

@akash-a-n akash-a-n left a comment

Choose a reason for hiding this comment

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

@akash-a-n made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on afrind, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


moxygen/MoQSession.cpp line 1941 at r1 (raw file):

Previously, afrind wrote…

Can you make a version of this PR in the upstream repo? I want to discuss with the other moxygen experts at meta

@afrind , I have not signed the CLA, would it be useful if I raise the upstream PR?

… abandoned publisher are correctly decremented
Copy link
Copy Markdown
Author

@akash-a-n akash-a-n left a comment

Choose a reason for hiding this comment

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

@akash-a-n made 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on afrind, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


moxygen/MoQSession.cpp line 1941 at r1 (raw file):

Previously, akash-a-n wrote…

@afrind , I have not signed the CLA, would it be useful if I raise the upstream PR?

create this anyway:
facebookexperimental#158

@afrind
Copy link
Copy Markdown

afrind commented May 6, 2026

I morphed this into this upstream PR facebookexperimental#159

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.

3 participants