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

Issue 850869 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 1
Type: Bug
Proj-Servicification



Sign in to add a comment

Network Service: Circular dependency between websocket mojom target and main mojom target causes compile flake

Project Member Reported by blundell@chromium.org, Jun 8 2018

Issue description

//services/network/public/mojom depends on //services/network/public/mojom:websocket (network_context.mojom imports websocket.mojom).

https://chromium-review.googlesource.com/c/chromium/src/+/1068592 moved network_param.mojom into the //services/network/public/mojom::websocket target. However, this makes the above dependency circular: network_param.typemap includes network_ipc_param_traits.h as a traits header, and the latter .h file includes several files that are generated from //services/network/public/mojom. In other words, //services/network/public/mojom:websocket now depends on //services/network/public/mojom, but it is not possible to specify that dependency.

The only ready fix that I can think of is to split //services/network/public/mojom into multiple targets, one of which is conceptually below websocket_mojom and can be depended on by the latter, and the other of which is above and depends on the latter. Not very elegant.

To see this lack of dependency manifest, the following works for me on Linux:

blundell:src(identity_manager_fetch_access_tokens) $  gn clean out/linux_debug/
blundell:src(identity_manager_fetch_access_tokens) $  ninja -j5000 -C out/linux_debug/ services/network/public/mojom:websocket_mojom

[2423/2425] CXX obj/services/network/p...ojom/websocket_mojom/websocket.mojom.o
FAILED: obj/services/network/public/mojom/websocket_mojom/websocket.mojom.o 
<snip>
In file included from gen/services/network/public/mojom/websocket.mojom.cc:32:
In file included from ../../services/network/public/cpp/network_ipc_param_traits.h:28:
In file included from ../../services/network/public/cpp/resource_request.h:17:
In file included from ../../services/network/public/cpp/resource_request_body.h:18:
../../services/network/public/cpp/data_element.h:24:10: fatal error: 'services/network/public/mojom/chunked_data_pipe_getter.mojom.h' file not found
#include "services/network/public/mojom/chunked_data_pipe_getter.mojom.h"

 
BTW, after I did the gn clean and resumed my regular work, the build problem exhibited itself on other targets I was trying to build. So this is definitely high-priority to fix. For anyone following at home who gets into this state, a workaround that got me out of this state was to build //services/network/public/mojom. The latter only requires that the websocket.mojom.h file have already been generated in order to build successfully (which by definition it has since the failure is on building websocket.mojom.cc), and once the latter is built, building //services/network/public/mojom:websocket will succeed since the required header files from //services/network/public/mojom have been generated.

Comment 2 by yutak@chromium.org, Jun 8 2018

Owner: yhirano@chromium.org
Assigned to a wrong person? :)
Whoops, apologies about that!

Comment 4 by ricea@chromium.org, Jun 8 2018

Components: Internals>Services>Network Blink>Network>WebSockets
I probably can fix it by splitting network_ipc_param_traits.h.

rockot@, I split websocket_mojom because of an issue related to lazy serialization. https://groups.google.com/a/chromium.org/forum/#!searchin/chromium-mojo/lazy$20serialization%7Csort:date/chromium-mojo/UoDBRD3GhVE/mJ-xpG6WBgAJ

Has that issue already been fixed? If so, I will merge websocket_mojom to mojom.
I don't recall if we ever figured out what the original issue was. I think
I was leaning towards lazy serialization + component build. mojom() targets
are source_sets, and so if you link that mojom into multiple components,
you will have duplicate definitions of its interfaces, and this could have
weird subtle side effects in the lazy case.

If you want to try merging them back together, make
//services/network/public/mojom:mojom a mojom_component() target. This is
of course incompatible with the use of export_*_blink settings that I see
there today. I'm not sure why that stuff is there, but it will probably be
unnecessary anyway if the mojom builds as its own component.
> #6

I spent some time but I couldn't do that due to undefined references for KURL functions. Probably I failed to define dependency correctly.

I'm splitting network_ipc_param_traits.h.

Comment 8 by roc...@chromium.org, Jun 11 2018

I see. The problem is url mojom. It's also not a component target, which means all of its dependents generating blink bindings will end up with an implicit dependency on KURL. The only way to resolve that dependency is to be linked into blink directly as part of its own component target.

The proper fix would be:

1. split KURL out into its a new leaf component target within blink
2. make //url/mojo:url_mojom_gurl a mojom_component target
3. make its blink traits depend explicitly on the KURL target

#1 seems hard since there are quite a few other blink "platform" deps in KURL.

We could change the way interface tagging works for lazy serialization, using a large random build-time value rather than a static symbol address as a tag. This is really only papering over actual ODR violations though.

In any case, it seems we should do something eventually. The whole "export_*_blink" junk just means we have random bits of Blink code scattered across the tree, and it's obviously very confusing and time consuming for everyone when things randomly go wrong.
I opened up https://bugs.chromium.org/p/chromium/issues/detail?id=851943 to track the sentiment that rockot@ expressed in c#8, which I strongly agree with but which is basically orthogonal to this bug. Let's continue any further discussion of those points there.

Comment 11 by dxie@chromium.org, Jun 12 2018

Labels: Proj-Servicification-Canary OS-Chrome OS-Linux OS-Mac OS-Windows
Project Member

Comment 12 by bugdroid1@chromium.org, Jun 13 2018

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

commit 48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd
Author: Yutaka Hirano <yhirano@chromium.org>
Date: Wed Jun 13 03:31:12 2018

Fix a circular build dependency in Network Service

//services/network/public/mojom:websocket is split from
//services/network/public/mojom:mojom due to an issue related with
lazy serialization[1]. network_param.mojom is in the
websocket_mojom target because websocket.mojom depends on the
file, but network_ipc_param_traits.(cc|h), some of its typemap
files, depend on services/network/public/cpp, and that results in
a circular build dependency.

This CL fixes that by splitting network_ipc_param_traits.(cc|h).

1: https://groups.google.com/a/chromium.org/d/msg/chromium-mojo/UoDBRD3GhVE/nizRiiOEBgAJ

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I31ee8c8e56f4e5b7087fc991b4b0059a8a5e9beb
Bug:  850869 
Reviewed-on: https://chromium-review.googlesource.com/1094911
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566707}
[modify] https://crrev.com/48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd/services/network/public/cpp/BUILD.gn
[add] https://crrev.com/48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd/services/network/public/cpp/net_ipc_param_traits.cc
[add] https://crrev.com/48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd/services/network/public/cpp/net_ipc_param_traits.h
[modify] https://crrev.com/48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd/services/network/public/cpp/network_ipc_param_traits.cc
[modify] https://crrev.com/48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd/services/network/public/cpp/network_ipc_param_traits.h
[modify] https://crrev.com/48046df2cae9e51455a8e6bd0dfa35b6af4fe8bd/services/network/public/cpp/network_param.typemap

Status: Fixed (was: Assigned)
Thanks!

Sign in to add a comment