ソースを参照

fix(ice-restart): Use an exponential backoff timer for ICE restarts. (#2531)

Use an exponential backoff time for initiating ICE restart to prevent loading the prosody.

When a large number of endpoints loose connection to the signaling and media servers because of an ISP failure, these endpoints will try to reconnect at the same time causing a storm of source-remove/source-add events to the signaling servers that can lead to prosody going down otherwise.
release-8443
Jaya Allamsetty 1年前
コミット
5a14bd43a5
コミッターのメールアドレスに関連付けられたアカウントが存在しません
2個のファイルの変更25行の追加20行の削除
  1. 25
    15
      JitsiConference.js
  2. 0
    5
      JitsiConferenceEventManager.js

+ 25
- 15
JitsiConference.js ファイルの表示

@@ -40,6 +40,7 @@ import Statistics from './modules/statistics/statistics';
40 40
 import EventEmitter from './modules/util/EventEmitter';
41 41
 import { safeSubtract } from './modules/util/MathUtil';
42 42
 import RandomUtil from './modules/util/RandomUtil';
43
+import { getJitterDelay } from './modules/util/Retry';
43 44
 import ComponentsVersions from './modules/version/ComponentsVersions';
44 45
 import VideoSIPGW from './modules/videosipgw/VideoSIPGW';
45 46
 import * as VideoSIPGWConstants from './modules/videosipgw/VideoSIPGWConstants';
@@ -325,6 +326,11 @@ export default function JitsiConference(options) {
325 326
 
326 327
     this._firefoxP2pEnabled = browser.isVersionGreaterThan(109)
327 328
         && (this.options.config.testing?.enableFirefoxP2p ?? true);
329
+
330
+    /**
331
+     * Number of times ICE restarts that have been attempted after ICE connectivity with the JVB was lost.
332
+     */
333
+    this._iceRestarts = 0;
328 334
 }
329 335
 
330 336
 // FIXME convert JitsiConference to ES6 - ASAP !
@@ -418,24 +424,21 @@ JitsiConference.prototype._init = function(options = {}) {
418 424
             }
419 425
         });
420 426
 
421
-    // Connection interrupted/restored listeners
422
-    this._onIceConnectionInterrupted
423
-        = this._onIceConnectionInterrupted.bind(this);
424
-    this.room.addListener(
425
-        XMPPEvents.CONNECTION_INTERRUPTED, this._onIceConnectionInterrupted);
427
+    // ICE Connection interrupted/restored listeners.
428
+    this._onIceConnectionEstablished = this._onIceConnectionEstablished.bind(this);
429
+    this.room.addListener(XMPPEvents.CONNECTION_ESTABLISHED, this._onIceConnectionEstablished);
426 430
 
427
-    this._onIceConnectionRestored = this._onIceConnectionRestored.bind(this);
428
-    this.room.addListener(
429
-        XMPPEvents.CONNECTION_RESTORED, this._onIceConnectionRestored);
431
+    this._onIceConnectionFailed = this._onIceConnectionFailed.bind(this);
432
+    this.room.addListener(XMPPEvents.CONNECTION_ICE_FAILED, this._onIceConnectionFailed);
430 433
 
431
-    this._onIceConnectionEstablished
432
-        = this._onIceConnectionEstablished.bind(this);
433
-    this.room.addListener(
434
-        XMPPEvents.CONNECTION_ESTABLISHED, this._onIceConnectionEstablished);
434
+    this._onIceConnectionInterrupted = this._onIceConnectionInterrupted.bind(this);
435
+    this.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, this._onIceConnectionInterrupted);
436
+
437
+    this._onIceConnectionRestored = this._onIceConnectionRestored.bind(this);
438
+    this.room.addListener(XMPPEvents.CONNECTION_RESTORED, this._onIceConnectionRestored);
435 439
 
436 440
     this._updateProperties = this._updateProperties.bind(this);
437
-    this.room.addListener(XMPPEvents.CONFERENCE_PROPERTIES_CHANGED,
438
-        this._updateProperties);
441
+    this.room.addListener(XMPPEvents.CONFERENCE_PROPERTIES_CHANGED, this._updateProperties);
439 442
 
440 443
     this._sendConferenceJoinAnalyticsEvent = this._sendConferenceJoinAnalyticsEvent.bind(this);
441 444
     this.room.addListener(XMPPEvents.MEETING_ID_SET, this._sendConferenceJoinAnalyticsEvent);
@@ -2854,8 +2857,15 @@ JitsiConference.prototype._onIceConnectionFailed = function(session) {
2854 2857
             reasonDescription: 'ICE FAILED'
2855 2858
         });
2856 2859
     } else if (session && this.jvbJingleSession === session) {
2860
+        // Use an exponential backoff timer for ICE restarts.
2861
+        const jitterDelay = getJitterDelay(this._iceRestarts, 1000 /* min. delay */);
2862
+
2857 2863
         this._delayedIceFailed = new IceFailedHandling(this);
2858
-        this._delayedIceFailed.start(session);
2864
+        setTimeout(() => {
2865
+            logger.error(`triggering ice restart after ${jitterDelay} `);
2866
+            this._delayedIceFailed.start(session);
2867
+            this._iceRestarts++;
2868
+        }, jitterDelay);
2859 2869
     }
2860 2870
 };
2861 2871
 

+ 0
- 5
JitsiConferenceEventManager.js ファイルの表示

@@ -235,11 +235,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
235 235
         JitsiConferenceEvents.CONFERENCE_FAILED,
236 236
         JitsiConferenceErrors.GRACEFUL_SHUTDOWN);
237 237
 
238
-    chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
239
-        jingleSession => {
240
-            conference._onIceConnectionFailed(jingleSession);
241
-        });
242
-
243 238
     this.chatRoomForwarder.forward(XMPPEvents.MUC_DESTROYED,
244 239
         JitsiConferenceEvents.CONFERENCE_FAILED,
245 240
         JitsiConferenceErrors.CONFERENCE_DESTROYED);

読み込み中…
キャンセル
保存