Skip to content

Infinite loop while re-sending pending DataChannel messages #3819

@vhristov

Description

@vhristov

Sometimes when the joining/initiating a call the browser freezes.
I was able to narrow it down to a "bad" data channel readyState ("connecting") in peer.js when onopen callback is called and there are pending messages for the channel. What happens is that during the re-transmission in sendDirectly the check for opened channel is failing and the message is queue in the pending messages. Which causes a new iteration on the loop with the "new" message, which is again queued, and so on.

I did a quick change adding a check to prevent re-transmission of pending messages when the datachannel readyState is not "open" (see vhristov@3c9e4c9), but I am not sure what are the side effects of it. So far for the last few days it seems to be working on my side without any issues observed. Calls seems to be working properly, without a need to mute/unmute (which was necessary when I simply commented out the re-send code).

Steps to reproduce

Connect to a call with someone

Expected behaviour

Call works

Actual behaviour

Browser tab sometimes freezes

Talk app

Talk app version:
9.0.0, 9.0.1, latest stable19

Custom Signaling server configured:
I have seen the issue on both internal signaling and recently opensourced version of HPB (both with and without MCU)

Custom TURN server configured:
I have seen the issue both with and without turn (local calls and remotes)
Custom STUN server configured:
yes

Browser

Microphone available: yes

Camera available: yes

Operating system:
both Windows 10 and Ubuntu 20.04

Browser name:
Chrome Version 81.0.4044.129 on Ubuntu
Latest Chrome on Windows (not exactly sure of the version)
I believe i have also seen the issue on firefox but not 100% sure.

Browser version:
(see above)

Browser log

Added extra logging in the peer.js in "channel.onopen":

const dc = self.getDataChannel(channel)
window['console'].log('channel onopen channel: ', channel.label, 'status: ', dc.readyState)

I observe the following:

webrtc.js:832 status datachannel is open
peer.js:321 channel onopen channel:  status status:  connecting
webrtc.js:832 simplewebrtc datachannel is open
peer.js:321 channel onopen channel:  simplewebrtc status:  connecting
webrtc.js:832 [object RTCDataChannel] datachannel is open
peer.js:321 channel onopen channel:  [object RTCDataChannel] status:  open

(the log is collected with the commit mentioned above, otherwise there is no way to get it)

Server configuration

Operating system: Ubuntu

Web server: Apache with Nginx ingress SSL termination

Database: PostgreSQL 11.8

PHP version: 7.4

Nextcloud Version: 19.01

List of activated apps:

Details

  - accessibility: 1.5.0
  - activity: 2.12.0
  - calendar: 2.0.3
  - cloud_federation_api: 1.2.0
  - comments: 1.9.0
  - contactsinteraction: 1.0.0
  - dav: 1.15.0
  - federatedfilesharing: 1.9.0
  - federation: 1.9.0
  - files: 1.14.0
  - files_pdfviewer: 1.8.0
  - files_rightclick: 0.16.0
  - files_sharing: 1.11.0
  - files_trashbin: 1.9.0
  - files_versions: 1.12.0
  - files_videoplayer: 1.8.0
  - firstrunwizard: 2.8.0
  - logreader: 2.4.0
  - lookup_server_connector: 1.7.0
  - metadata: 0.11.1
  - nextcloud_announcements: 1.8.0
  - notifications: 2.7.0
  - oauth2: 1.7.0
  - onlyoffice: 4.2.0
  - password_policy: 1.9.1
  - photos: 1.1.0
  - privacy: 1.3.0
  - provisioning_api: 1.9.0
  - recommendations: 0.7.0
  - serverinfo: 1.9.0
  - settings: 1.1.0
  - sharebymail: 1.9.0
  - spreed: 9.0.1
  - support: 1.2.1
  - survey_client: 1.7.0
  - systemtags: 1.9.0
  - text: 3.0.1
  - theming: 1.10.0
  - twofactor_backupcodes: 1.8.0
  - updatenotification: 1.9.0
  - user_ldap: 1.9.0
  - viewer: 1.3.0
  - workflowengine: 2.1.0

Nextcloud configuration:

Details

{
    "system": {
        "trashbin_retention_obligation": "30, 60",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\Illustrator",
            "OC\\Preview\\Photoshop",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\SVG",
            "OC\\Preview\\Movie"
        ],
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "domain.com",
            "192.168.1.0\/8",
            "10.0.0.0\/24",
            "*"
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "19.0.0.12",
        "overwrite.cli.url": "https:\/\/domain.com",
        "overwriteprotocol": "https",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "app_install_overwrite": [
            "spreed"
        ],
        "theme": "",
        "loglevel": 2,
        "maintenance": false
    }
}

Server log (data/nextcloud.log)

Nothing of interesting

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions