W3C home > Mailing lists > Public > public-webrtc@w3.org > May 2017

[webrtc-pc] Race condition in enqueue an operation

From: Soares Chen via GitHub <sysbot+gh@w3.org>
Date: Wed, 17 May 2017 08:01:00 +0000
To: public-webrtc@w3.org
Message-ID: <issues.opened-229268070-1495008058-sysbot+gh@w3.org>
soareschen has just created a new issue for https://github.com/w3c/webrtc-pc:

== Race condition in enqueue an operation ==
In step 6 of enqueue an operation:

> 6. If the length of [[operations]] is exactly 1, execute operation.

This result in race condition with synchronous code following call to RTCPeerConnection methods. That is, if length of the operation queue is 1, the operation is executed _before_ the next line of synchronous code; But if the length of operation queue is > 1, the operation is executed _after_ the current microtask return to the event loop. This can result in code having unexpected behavior depending on whether the internal operation queue is empty or not when the operation is enqueued.

For example, if the next line of code is `peerconnection.close()`, then the result can be very different.

To fix this, the operation should be enqueued to the next tick if the length of operation queue is 1.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1218 using your GitHub account
Received on Wednesday, 17 May 2017 08:01:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:50 UTC