Bug #3356
Updated by Alex Afanasyev almost 9 years ago
On a freshly installed FreeBSD 10.1 slave, I'm getting the following unit test failures: ``` vagrant@freebsd-10 /usr/home/vagrant/ndn-cxx]$ ./build/unit-tests Running 615 test cases... unknown location(0): fatal error in "EndToEnd": signal: subscript out of range; address of failing instruction: 0x087709cc ../tests/unit-tests/util/notification-subscriber.t.cpp(65): last checkpoint unknown location(0): fatal error in "DeprecatedExpressInterestData": memory access violation at address: 0x00000017: no mapping at fault address ../tests/unit-tests/face.t.cpp(96): last checkpoint *** 2 failures detected in test suite "ndn-cxx Unit Tests"``` ``` I tracked down that both of these errors are related to `Face::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)`. In particular, it seemed that onData callback (in the failed cases, a lambda is supplied) is not copied by value, even though it is requested... If I apply the following patch, which per my understanding shouldn't change anything, the failure goes away: ```patch diff --git a/src/face.cpp b/src/face.cpp index 9d6b0dd..72dcdba 100644 --- a/src/face.cpp +++ b/src/face.cpp @@ -155,9 +155,10 @@ Face::expressInterest(const Interest& interest, const PendingInterestId* Face::expressInterest(const Interest& interest, - const OnData& onData, + const OnData& onData1, const OnTimeout& onTimeout) { + OnData onData = onData1; return this->expressInterest( interest, [onData] (const Interest& interest, const Data& data) { ``` **Is it a clang bug? Or something wrong with the way we use lambdas?** * * * Few system parameters: - FreeBSD 10.1 32bit: - FreeBSD freebsd-10.1-i386 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 22:51:51 UTC 2014 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC i386 - FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 - FreeBSD 10.2 64bit: - FreeBSD 10.2-RELEASE-p7 FreeBSD 10.2-RELEASE-p7 #0: Mon Nov 2 14:19:39 UTC 2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 - FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512