This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Fix intermittent failure with instrprof-gcov-multithread_fork.test on 32-bit arm
AbandonedPublic

Authored by MaskRay on Jun 11 2020, 6:44 AM.

Details

Reviewers
rovka
calixte
Summary

This test was added with patch to fix a crash in code coverage:
https://reviews.llvm.org/rGbec223a9bc4eb9747993ee9a4c1aa135c32123e6
So this patch aims to fix an intermittent error terminate called recursively likely caused by having too much threads (6).
and not related to the cov issue fixed in the above patch.

Diff Detail

Event Timeline

calixte created this revision.Jun 11 2020, 6:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2020, 6:44 AM
Herald added subscribers: Restricted Project, danielkiss, kristof.beyls, dberris. · View Herald Transcript
rovka added a comment.EditedJun 15 2020, 1:45 AM

Hi! This doesn't seem to be enough. I suspect this is because the exception is thrown from one of the other threads rather than the main thread. Maybe f also needs a try-catch block? I'm going to give it a few runs and report back. EDIT: Actually I think I'll move the try-catch closer to the root of the problem, in launcher. I'll post if that worked.

For reference, this is the backtrace I'm getting:
Thread 378 "instrprof-gcov-" received signal SIGABRT, Aborted.
[Switching to Thread 0xaeaf7450 (LWP 26971)]
libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
47 ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: No such file or directory.
(gdb) bt
#0
libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47
#1 0xb6d0db32 in libc_signal_restore_set (set=0xaeaf6a3c) at ../sysdeps/unix/sysv/linux/nptl-signals.h:80
#2
GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:48
#3 0xb6d0e82e in GI_abort () at abort.c:79
#4 0xb6efdd00 in
gnu_cxx::verbose_terminate_handler() () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#5 0xb6efc498 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#6 0xb6efc4ee in std::terminate() () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#7 0xb6efc728 in
cxa_throw () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#8 0xb6f19ee4 in std::throw_system_error(int) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#9 0xb6f1a126 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#10 0x00012bdc in std::thread::thread<void (*&)()> (this=0xaeaf6db0,
f=@0xaeaf6dc4: 0x11108 <h()>) at /usr/lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../include/c++/7.5.0/thread:126
#11 0x00012564 in launcher<void (*)()> (func=0x11108 <h()>) at /tmp/llvm-project/compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp:11
#12 0x000111f4 in g () at /tmp/llvm-project/compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp:23
#13 0x000167dc in std::invoke_impl<void, void (*)()> (f=@0xad9015fc: 0x11160 <g()>) at /usr/lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:60
#14 0x0001668c in std::invoke<void (*)()> (fn=@0xad9015fc: 0x11160 <g()>) at /usr/lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:95
#15 0x00016618 in std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0u> (this=0xad9015fc) at /usr/lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../include/c++/7.5.0/thread:234
#16 0x000165a0 in std::thread::_Invoker<std::tuple<void (*)()> >::operator() (this=0xad9015fc) at /usr/lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../include/c++/7.5.0/thread:243
#17 0x000161c0 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run (this=0xad9015f8) at /usr/lib/gcc/arm-linux-gnueabihf/7.5.0/../../../../include/c++/7.5.0/thread:186
#18 0xb6f19f52 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#19 0xb6fa3614 in start_thread (arg=0x848e5c15) at pthread_create.c:463
#20 0xb6d817fc in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

rovka added a comment.Jun 15 2020, 2:40 AM

Um, I tried to upload a diff here but it didn't work, so I just created a new revision: https://reviews.llvm.org/D81830
Hope that's ok (if not feel free to re-upload here).

MaskRay requested changes to this revision.Jun 26 2020, 11:46 AM
MaskRay added a subscriber: MaskRay.

This can be abandoned if superseded by D81830.

This revision now requires changes to proceed.Jun 26 2020, 11:46 AM
MaskRay commandeered this revision.Aug 2 2020, 9:14 PM
MaskRay edited reviewers, added: calixte; removed: MaskRay.
This revision now requires review to proceed.Aug 2 2020, 9:14 PM
MaskRay abandoned this revision.Aug 2 2020, 9:15 PM