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

Issue 650499 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug



Sign in to add a comment

SequencedTaskRunnerHandle::IsSet() doesn't work correctly in debug mode after linker optimizations

Project Member Reported by jamiewa...@chromium.org, Sep 27 2016

Issue description

What steps will reproduce the problem?
(1) Start Chromoting web-app.
(2) Connect to any host.

What is the expected output?
Connection should succeed.

What do you see instead?
[0926/234105:FATAL:thread_task_runner_handle.cc(41)] Check failed: !SequencedTaskRunnerHandle::IsSet(). 

Bisect suggests that the culprit is https://codereview.chromium.org/2241703002

I've tried adding a call to RedirectToTaskSchedulerForProcess as suggested in that CL, but it fails with:

[0926/235316:FATAL:sequenced_worker_pool.cc(1446)] Check failed: TaskScheduler::GetInstance(). 

From the comment in https://codereview.chromium.org/2241703002: "There must be a registered TaskScheduler when this is called." Could it be that our NaCl plugin doesn't have one?
 
This only affects debug builds, so it's not a P0.
Owner: sergeyu@chromium.org
Status: Assigned (was: Untriaged)
Status: Started (was: Assigned)
This looks like a problem either in the compiler or PNaCl translator.
Problem is that SequencedTaskRunnerHandle::IsSet() returns true, when it should return false.

bool SequencedTaskRunnerHandle::IsSet() {
  return lazy_tls_ptr.Pointer()->Get() ||
         SequencedWorkerPool::GetSequenceTokenForCurrentThread().IsValid() ||
         base::ThreadTaskRunnerHandle::IsSet();
}

When this code is executed each of these 3 conditions is false, but the function returns true.
Still investigating what the root cause is.
Components: Platform>NaCl
Labels: -Pri-0 Pri-1
The PNaCl code generated by the compiler seems correct, so it looks like the problem is in the PNaCl translator. 
Just reordering the operands in the return statement makes issue go away:

  return SequencedWorkerPool::GetSequenceTokenForCurrentThread().IsValid() ||
      base::ThreadTaskRunnerHandle::IsSet() || lazy_tls_ptr.Pointer()->Get();



Actually it appears the the issue is caused by optimizer in the PNaCl linker. The .o file contains correct code, but the optimized code in pexe is incorrect. I see the following code at the end of SequencedTaskRunnerHandle::IsSet() in the pexe file:

cleanup.done:                                     ; preds = %lor.end.cleanup.done_crit_edge, %_ZN4base19SequencedWorkerPool32GetSequenceTokenForCurrentThreadEv.exit, %_ZN4base18ThreadLocalPointerINS_25SequencedTaskRunnerHandleEE3GetEv.exit
  %.ret_ext = zext i1 true to i32, !dbg !1124856
  ret i32 %.ret_ext, !dbg !1124856

I.e. the function always returns true. This is obviously wrong.
Labels: OS-All
The problem also goes away when I add __attribute__((optnone)) to SequencedTaskRunnerHandle::IsSet(), which disables all optimizations for that function.
Cc: bradnelson@chromium.org
Owner: ----
Status: Untriaged (was: Started)
Summary: SequencedTaskRunnerHandle::IsSet() doesn't work correctly in debug mode after linker optimizations (was: Chromoting NaCl plugin crashes on connect)
+bradnelson@ for triage.
I'm going to land https://codereview.chromium.org/2384553002/ as a workaround for CRD.
Components: -Services>Chromoting
Project Member

Comment 9 by bugdroid1@chromium.org, Sep 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f1f0af26d41c5119403b0781d804f7860e237871

commit f1f0af26d41c5119403b0781d804f7860e237871
Author: sergeyu <sergeyu@chromium.org>
Date: Thu Sep 29 21:27:03 2016

Disable link-time optimization for remoting PNaCl plugin in Debug mode

Optimization was enabled for the plugin to workaround an issue with
linking libyuv. But that issue has been fixed, so it's not longer
necessary to optimize debug builds.

This also works around PNaCl link-time optimization bug that was
breaking debug builds. That bug currently doesn't affect non-debug
builds (if it breaks release builds in the future it's also possible
to work it around by disabling optimization with per-function
optnone attribute).

BUG=650499

Review-Url: https://codereview.chromium.org/2384553002
Cr-Commit-Position: refs/heads/master@{#421938}

[modify] https://crrev.com/f1f0af26d41c5119403b0781d804f7860e237871/remoting/client/plugin/BUILD.gn

Comment 10 by gab@chromium.org, Nov 7 2016

Components: Internals>TaskScheduler

Comment 11 by gab@chromium.org, Nov 7 2016

Just stumbled on this, fixed?
Cc: -bradnelson@chromium.org
Owner: bradnelson@chromium.org
Assigning to bradnelson@chromium.org for triage. Maybe this is fixed now with the revert?

Comment 13 by gab@chromium.org, May 9 2018

Components: -Internals>TaskScheduler Internals
ping?

Please close if this is no longer an issue (and it definitely isn't a TaskScheduler implementation issue so I'm removing that label).

Thanks!
Status: Assigned (was: Untriaged)
This bug has an owner, thus, it's been triaged. Changing status to "assigned".
Components: -Internals

Sign in to add a comment