New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 836870 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocked on:
issue 781655



Sign in to add a comment

Potential race in SpeechRecognitionDispatcherHost

Project Member Reported by adithyas@chromium.org, Apr 25 2018

Issue description

Currently, OnStartRequest is called on the UI thread and then posts a task on the IO thread to start a session. It is however possible for another message to be handled on the IO thread, while OnStartRequest is being processed on the main thread (for example, OnStopCaptureRequest).

So theoretically it looks like we could have:

var recognition = new SpeechRecognition();
recognition.start();
recognition.stop();

and the call to stop() fails because start() hasn't finished executing and a session hasn't started.
 
Cc: olka@chromium.org maxmorin@chromium.org
kinuko@ pointed this out while reviewing my CL (https://crrev.com/c/1013687) to convert the renderer -> browser messages to Mojo. The problem still exists in the CL after mojofication and I was wondering if this is a known issue and if you have any ideas on how to fix this?
Cc: kinuko@chromium.org
I'm not familiar with the code, but I think the mojo-y way to fix it would be to have the browser->renderer messages be sent on some interface (SpeechRecognitionClient) and send a SpeechRecognitionClientPtr in with each StartRequest (instead of request_id). Then, to stop, just destroy the SpeechRecognitionClient binding on the renderer side (no need for a separate message).
Blockedon: 781655
Owner: adithyas@chromium.org
Status: Assigned (was: Untriaged)
That should work, I'll change the implementation to do something like that when I convert the browser->renderer messages.
Status: Fixed (was: Assigned)
This was fixed in https://crrev.com/db1039b3ed35c9424981b4d2db15ed2cf1187f6c. Stop messages are sent on a separate pipe, and is guaranteed to be processed only after Start finishes (the pipe is only opened after Start is completed).

Sign in to add a comment