Closed Bug 1724420 Opened 3 years ago Closed 3 years ago

An "SCTP timer" thread remains in every content process that used a peer connection, and uses CPU

Categories

(Core :: WebRTC: Networking, defect)

defect

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: florian, Assigned: bwc)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 file)

I have two content processes that have used peer connections (but afaik these connections no longer exist). Each of them has an "SCTP timer" thread that according to about:processes (with toolkit.aboutProcesses.showThreads set to true in about:config) uses 0.2% of a CPU core each.

I don't know what this thread does with the CPU, it is named at https://searchfox.org/mozilla-central/rev/67637695876e27ddbfb6ff99202bb1c951de847a/netwerk/sctp/src/netinet/sctp_callout.c#198 but doesn't seem to be registered with the Gecko Profiler.

See Also: → 1341811

I believe sctp is only used for webrtc. Maybe Nils knows if we can do something about it.

Flags: needinfo?(drno)

This thread seems to remain active forever in any content process that ever used a data channel (I verified using the demo at https://tomashubelbauer.github.io/webrtc-data-channel-demo/src/index.html). I see this in Slack tabs, my bank's website, air mozilla. https://searchfox.org/mozilla-central/rev/67637695876e27ddbfb6ff99202bb1c951de847a/netwerk/sctp/src/netinet/sctp_callout.c#193,201,206,209 causes a CPU wakeup every 10ms, which probably wastes a lot of power.

So questions:

  1. Is this 10ms repeating timer really needed in the first place? Could the same result be achieved in a more power efficient way?
  2. Can we ensure this thread is stopped when it's no longer useful?
  3. Would it be possible to register this thead with the Gecko Profiler?
Component: Networking → WebRTC: Networking
Flags: needinfo?(drno) → needinfo?(docfaraday)

(In reply to Florian Quèze [:florian] from comment #3)

This thread seems to remain active forever in any content process that ever used a data channel (I verified using the demo at https://tomashubelbauer.github.io/webrtc-data-channel-demo/src/index.html). I see this in Slack tabs, my bank's website, air mozilla. https://searchfox.org/mozilla-central/rev/67637695876e27ddbfb6ff99202bb1c951de847a/netwerk/sctp/src/netinet/sctp_callout.c#193,201,206,209 causes a CPU wakeup every 10ms, which probably wastes a lot of power.

So questions:

  1. Is this 10ms repeating timer really needed in the first place? Could the same result be achieved in a more power efficient way?

Unsure, but this thread is internal to libusrsctp, so our control here is limited.

  1. Can we ensure this thread is stopped when it's no longer useful?

Currently, no. See bug 1646716. We're waiting on a TSan fix from upstream, and once we have that, we can then evaluate whether it is safe to try.

  1. Would it be possible to register this thead with the Gecko Profiler?

So this thread is internal to libusrsctp, but maybe we could wait for the first callback we get from that thread and register at that time?

Depends on: 1646716
Flags: needinfo?(docfaraday)
Assignee: nobody → docfaraday
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: