Segfault in on Ubuntu 14.04 32-bit

111 views
Skip to first unread message

Zachary Dremann

unread,
Nov 4, 2020, 5:27:21 PM11/4/20
to Cap'n Proto
I'm running on Ubuntu 14.04, 32 bit.

I have a custom g++ 10.1.0 as g++-10 installed in /usr/local, built from source with no modifications or customizations

I cloned from master (commit 96936a7446164424d8f3f50430d83ee21f63f6a2), and ran `autoreconf -fi`, then `./configure --without-openssl --with-pic LDFLAGS='-L/usr/local/lib -Wl,-rpath,/usr/local/lib' CXX=/usr/local/bin/g++-10`, followed by `make`, and `make check`.

`VERBOSE=1 make check` fails with (truncated to show interesting stuff):

[ TEST ] kj/async-test.c++:860: start a fiber
[ PASS ] kj/async-test.c++:860: start a fiber (112 μs)
[ TEST ] kj/async-test.c++:881: fiber promise chaining
[ PASS ] kj/async-test.c++:881: fiber promise chaining (9 μs)
[ TEST ] kj/async-test.c++:904: throw from a fiber
/bin/bash: line 5: 22656 Segmentation fault      (core dumped) ${dir}$tst
FAIL: capnp-test
Randomly testing backwards-compatibility scenarios with seed: 1604520183
PASS: capnp-evolution-test
PASS: src/capnp/compiler/capnp-test.sh
===========================================
1 of 3 tests failed
Please report to capn...@googlegroups.com
===========================================

Running `libtool --mode=execute gdb ./capnp-test`, and getting a backtrace at the time of the segfault gives the following:

#0  0xb793d71e in x86_fallback_frame_state (context=<optimized out>, context=<optimized out>, fs=0xb57565b0)
    at ./md-unwind-support.h:132
#1  uw_frame_state_for () at ../../../gcc-10.1.0/libgcc/unwind-dw2.c:1271
#2  0xb793ecb1 in _Unwind_Backtrace () at ../../../gcc-10.1.0/libgcc/unwind.inc:302
#3  0xb7876d75 in __GI___backtrace (array=0xb5756720, size=34) at ../sysdeps/i386/backtrace.c:126
#4  0xb7bb098a in kj::getStackTrace(kj::ArrayPtr<void*>, unsigned int) ()
   from /home/build/capnproto/c++/.libs/libkj-0.9-dev.so
#5  0xb7bb0b39 in kj::Exception::extendTrace(unsigned int) () from /home/build/capnproto/c++/.libs/libkj-0.9-dev.so
#6  0xb7bb0c62 in kj::throwRecoverableException(kj::Exception&&, unsigned int) ()
   from /home/build/capnproto/c++/.libs/libkj-0.9-dev.so
#7  0x0820011c in kj::Promise<void>::wait(kj::WaitScope&) ()
#8  0x081e1620 in kj::_::Fiber<kj::(anonymous namespace)::TestCase904::run()::{lambda(kj::WaitScope&)#1}>::runImpl(kj::WaitScope&) ()
#9  0xb7c36203 in kj::_::RunnableImpl<kj::_::FiberBase::run()::{lambda()#2}>::run() ()
   from /home/build/capnproto/c++/.libs/libkj-async-0.9-dev.so
#10 0xb7bb0ed2 in kj::_::runCatchingExceptions(kj::_::Runnable&) ()
   from /home/build/capnproto/c++/.libs/libkj-0.9-dev.so
#11 0xb7c3b9de in kj::_::FiberBase::run() () from /home/build/capnproto/c++/.libs/libkj-async-0.9-dev.so
#12 0xb7c3bdf7 in kj::_::FiberStack::run() () from /home/build/capnproto/c++/.libs/libkj-async-0.9-dev.so
#13 0xb7c42c09 in kj::_::FiberStack::StartRoutine::run(int, int) ()
   from /home/build/capnproto/c++/.libs/libkj-async-0.9-dev.so
#14 0xb77bbdeb in makecontext () at ../sysdeps/unix/sysv/linux/i386/makecontext.S:87
#15 0x00008c48 in ?? ()
#16 0x00000862 in ?? ()
#17 0x00000000 in ?? ()

Kenton Varda

unread,
Nov 6, 2020, 1:20:53 PM11/6/20
to Zachary Dremann, Cap'n Proto
Hi Zachary,

It looks like the segfault is happening in glibc's backtrace() function while gathering the stack trace for an exception. An exception is actually expected here (the test case tests throwing an exception). Since it happened specifically in fiber-related tests, my guess is that glibc's backtrace has a bug in which it is confused by the stack manipulation done by fibers.

14.04 is quite old, so I imagine you're using a pretty old glibc here? Maybe this is a glibc bug that was fixed in newer versions?

Note that fibers are new and completely optional feature of KJ. If you don't use them then you can probably ignore the test failure.

-Kenton

--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/71489f35-286d-4967-aecd-636276f3dfb4n%40googlegroups.com.

Zachary Dremann

unread,
Nov 9, 2020, 3:41:45 PM11/9/20
to Cap'n Proto

I rebuilt everything in the same way on an ubuntu 16.04 VM, and I don't get the segfault. I don't need to use fibers, so I'm okay to just avoid them.

Kenton Varda

unread,
Nov 9, 2020, 5:52:12 PM11/9/20
to Zachary Dremann, Cap'n Proto
Yep, that looks like a smoking gun to me.

-Kenton

Reply all
Reply to author
Forward
0 new messages