New issue
Advanced search Search tips

Issue 764555 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

clang hanging during compilation of third_party/ffmpeg/ffmpeg_internal/vp8.o

Project Member Reported by dalecur...@chromium.org, Sep 12 2017

Issue description

Sync ToT (afeb6eb5015b3ffa8d04e01f5b00b2545a2d3d47), noticeable this for the first time sometime yesterday.

$ echo $GN_DEFINES
is_component_build=true proprietary_codecs=true enable_nacl=false dcheck_always_on=true use_goma=true is_clang=true symbol_level=1 enable_mse_mpeg2ts_stream_parser=true enable_ac3_eac3_audio_demuxing=true ffmpeg_branding="ChromeOS" is_debug=false use_libfuzzer=true is_asan=true is_ubsan=true

$ cd out/Release/
$ ../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF obj/third_party/ffmpeg/ffmpeg_internal/vp8.o.d -DHAVE_AV_CONFIG_H -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DFF_API_CONVERGENCE_DURATION=0 -D_ISOC99_SOURCE -D_LARGEFILE_SOURCE -DV8_DEPRECATION_WARNINGS -DDCHECK_ALWAYS_ON=1 -DUSE_UDEV -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DNO_TCMALLOC -DMEMORY_TOOL_REPLACES_ALLOCATOR -DMEMORY_SANITIZER_INITIAL_SIZE -DADDRESS_SANITIZER -DLEAK_SANITIZER -DUNDEFINED_SANITIZER -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION="312679-1" -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DCOMPONENT_BUILD -DSANITIZER_COVERAGE -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../../third_party/ffmpeg/chromium/config/ChromeOS/linux/x64 -I../../third_party/ffmpeg -I../.. -Igen -I../../third_party/opus/src/include -fPIC -fomit-frame-pointer -Wno-deprecated-declarations -std=c99 -pthread -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -B../../third_party/binutils/Linux_x64/Release/bin -pthread -fcolor-diagnostics -m64 -march=x86-64 -g1 -gline-tables-only -gcolumn-info -fno-omit-frame-pointer -fsanitize-coverage=trace-pc-guard -mllvm -sanitizer-coverage-prune-blocks=1 -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-blacklist=../../tools/memory/asan/blacklist.txt -fsanitize=leak -fsanitize=float-divide-by-zero -fsanitize=integer-divide-by-zero -fsanitize=null -fsanitize=object-size -fsanitize=return -fsanitize=returns-nonnull-attribute -fsanitize=shift-exponent -fsanitize=signed-integer-overflow -fsanitize=unreachable -fsanitize=vla-bound -fsanitize-blacklist=../../tools/ubsan/blacklist.txt -mllvm -regalloc=pbqp -mllvm -pbqp-coalescing -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-auto-raw-pointer -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Werror -Wall -Wno-unused-variable -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -Wno-incompatible-pointer-types -Wno-absolute-value -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-logical-op-parentheses -Wno-parentheses -Wno-pointer-sign -Wno-switch -Wno-unused-label -Wno-unused-variable -Wno-string-conversion -Wno-sometimes-uninitialized -Wno-unguarded-availability -Wno-unused-function -Wno-constant-conversion -O2 -fno-ident -fdata-sections -ffunction-sections -fvisibility=default -std=gnu11 --sysroot=../../build/linux/debian_jessie_amd64-sysroot -c ../../third_party/ffmpeg/libavcodec/vp8.c -o obj/third_party/ffmpeg/ffmpeg_internal/vp8.o

<sits here forever; for values of forever <= 2 hours at least >
 
$ clang --version
clang version 6.0.0 (trunk 312679)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /d/code/chrome/src/third_party/llvm-build/Release+Asserts/bin

Comment 2 by thakis@chromium.org, Sep 13 2017

Cc: h...@chromium.org
Labels: clang
Sorry Hans, looks your still busy debugging taskqueue flakiness :-( maybe someone else in the team can take a look...

Comment 3 by h...@chromium.org, Sep 13 2017

I'll take a look tomorrow.

Dale, is this a build config that's used on a bot somewhere, or where does it come from?

Comment 4 by h...@chromium.org, Sep 13 2017

I've tried all the way back to August 1 (1a159a003ca82e0b0bd653078dbde80757bf9e2c), but the compile of that file sits there forever (five minutes or so).

Are you saying this is a regression and used to work recently? How long did the compile usually take?

Comment 5 by h...@chromium.org, Sep 13 2017

The time is spent in the PBQP register allocator:


#1  0x00000000019eef55 in count (Val=..., this=0x7fffffff9b90) at ../include/llvm/ADT/DenseMap.h:143
#2  count (V=..., this=0x7fffffff9b90) at ../include/llvm/ADT/DenseSet.h:92
#3  (anonymous namespace)::Interference::apply (this=<optimized out>, G=...) at ../lib/CodeGen/RegAllocPBQP.cpp:376
#4  0x00000000019e6468 in llvm::PBQPRAConstraintList::apply (this=<optimized out>, G=...) at ../include/llvm/CodeGen/PBQPRAConstraint.h:55
#5  0x00000000019f1f52 in (anonymous namespace)::RegAllocPBQP::runOnMachineFunction (this=0x7c96480, MF=...) at ../lib/CodeGen/RegAllocPBQP.cpp:826

I didn't even know Clang used that by default; and it doesn't, it's because we pass in these flags when building:


-mllvm -regalloc=pbqp -mllvm -pbqp-coalescing

Those flags are added here:

https://cs.chromium.org/chromium/src/build/config/sanitizers/BUILD.gn?rcl=cefe5557b34e3cb4723508c9856d8fd964de9f26&l=467

    # Chromecast ubsan builds fail to compile with these
    # experimental flags, so only add them to non-chromecast ubsan builds.
    if (!is_chromecast) {
      cflags += [
        # Employ the experimental PBQP register allocator to avoid slow
        # compilation on files with too many basic blocks.
        # See  http://crbug.com/426271 .
        "-mllvm",
        "-regalloc=pbqp",


And it's been that way a long time. I'm still not sure what changed here.

I'm suspecting this is essentially a dupe of https://bugs.llvm.org/show_bug.cgi?id=17409 i.e. register allocation takes forever on certain large pieces of code.
Cc: mmoroz@chromium.org
Ah, hmm, I got these flags from ClusterFuzz... It did succeed once yesterday with these flags and I thought I had built it this way before too. I did recently add these to my config, so I may have messed something up. +mmoroz because presumably the libfuzzer builds are hanging or taking forever to build somewhere with these ubsan flags...
Hmm, I guess what's unique about my config is it's setting is_asan + is_ubsan, vs the bots which are just setting is_ubsan_for_security, which is a flag code search doesn't seem to find... How is that one different then is_ubsan + is_asan mmoroz?

enable_nacl = false
ffmpeg_branding = "ChromeOS"
goma_dir = "/b/build/slave/cache/goma_client"
is_debug = false
is_ubsan_security = true
optimize_for_fuzzing = true
pdf_enable_xfa = true
proprietary_codecs = true
use_libfuzzer = true

Comment 9 by mmoroz@chromium.org, Sep 14 2017

1) is_ubsan is  a general purpose UBSan config, there are many different flags enabled:  
https://cs.chromium.org/chromium/src/build/config/sanitizers/BUILD.gn?l=442

I think it's being used for fuzzing, but not with libFuzzer-based stuff (https://bugs.chromium.org/p/chromium/issues/list?can=1&q=Description%3Alinux_ubsan_chrome%2Clinux_ubsan_pdfium&colspec=ID+Pri+M+Stars+ReleaseBlock+Component+Status+Owner+Summary+OS+Modified&x=m&y=releaseblock&cells=ids)


2) is_ubsan_security purpose is to detect bugs that MAY BE security issues. It has been created because general "ubsan" config (#1 described above) has too many different flags enabled:
https://cs.chromium.org/chromium/src/build/config/sanitizers/BUILD.gn?q=is_ubsan_security&sq=package:chromium&dr=C&l=491


I'm not sure if I got your point about is_asan + is_ubsan. Do you want to enable both sanitizers at the same time?
There is a 3rd configuration, by the way, is_ubsan_vptr: https://cs.chromium.org/chromium/src/build/config/sanitizers/BUILD.gn?l=510

This is a separate build with -fsanitize=vptr flag only. The main goal here is to detect type confusion bugs, which are valid security issues in most of the cases.


Thanks, not sure why code search didn't find those earlier...

That was the idea and what I thought ClusterFuzz did :) I was hoping to avoid rebuilding every time I got a ubsan vs an asan test case, but seems like that dream may not be possible currently.
I see.. Yeah, in general ASan + UBSan should work together, but there might be some edge cases where instrumentation becomes too complicated or even incompatible, as those tools were implemented by different groups of people :/

Sign in to add a comment