New issue
Advanced search Search tips

Issue 684216 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

Figure out what's going on with network_time_test_utils needing to reset a null pointer

Project Member Reported by est...@chromium.org, Jan 24 2017

Issue description

network_time::FieldTrialTest needs to reset its (null) field_trial_list_ before instantiating it, to avoid hitting a DCHECK [1]. I'm pretty sure we're doing something wrong here, since we shouldn't need to reset a null pointer before assigning to it. So, we should figure out what that reset is doing and why we need it and how to get rid of it.

[1] https://cs.chromium.org/chromium/src/base/metrics/field_trial.cc?q=%22DCHECK(!global_)%22&sq=package:chromium&l=492
 

Comment 1 by est...@chromium.org, Jan 24 2017

(Internals>CertAnalysis is for lack of a better label. Vaguely relates to CertAnalysis since it's about bad clock detection which is sort of a cert analysis project.)

Comment 2 by est...@chromium.org, Jan 24 2017

Summary: Figure out what's going on with network_time_test_utils needing to reset a null pointer (was: Figure out what's going on with network_time_test_utils needed to reset a null pointer)

Comment 3 by mea...@chromium.org, Jan 24 2017

Is it possible that one of the test classes have multiple field_trial_list members (e.g. one of them coming from the base class) that initialize the field trials?

FieldTrialList documentation says there should be only one instance of it. Perhaps network_time_test_utils should first try to find an existing one before creating anew?

Comment 4 by est...@chromium.org, Jan 24 2017

Re #3: it does seem like there must be a FieldTrialList being created somewhere unexpected... it's not obvious where though. The test fixtures themselves don't seem to create FieldTrialLists.

It wouldn't surprise me if something somewhere was creating an additional FieldTrialList, but it does surprise me that resetting a null pointer does anything at all. Does that make any sense to you?

Comment 5 by mea...@chromium.org, Jan 24 2017

It looks like the constructor is called twice through FieldTrialTest::SetNetworkQueriesWithVariationsService, once in NetworkTimeTrackerTest and then in the tests (e.g. NetworkTimeTrackerTest, StartTimeFetchWithoutVariationsParam).

Removing SetNetworkQueriesWithVariationsService call from NetworkTimeTrackerTest obviates the need for the null hack, but then you'll need to call it separately in each test.

You could also keep the reset(nullptr) code and then add a comment saying why it's needed.
Status: Started (was: Assigned)
Thanks for figuring out what was going on, meacer!
Project Member

Comment 7 by bugdroid1@chromium.org, Jun 8 2017

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

commit f397511c435587def5e9d55a2d26a23324f89956
Author: estark <estark@chromium.org>
Date: Thu Jun 08 18:28:57 2017

Update a comment in network time test helper

BUG= 684216 

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

[modify] https://crrev.com/f397511c435587def5e9d55a2d26a23324f89956/components/network_time/network_time_test_utils.cc

Labels: -M-58 M-61
Status: Fixed (was: Started)

Sign in to add a comment