Project

General

Profile

Actions

Bug #3356

closed

Compatibility wrapper Face::expressInterest causes segfault on FreeBSD 10.1/10.2 32bit/64bit platform

Added by Alex Afanasyev over 8 years ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Category:
Build
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Tags:

Description

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:

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
Actions #1

Updated by Alex Afanasyev over 8 years ago

  • Subject changed from Compatibility wrapper Face::expressInterest causes segfault on FreeBSD 10.1 32bit platform to Compatibility wrapper Face::expressInterest causes segfault on FreeBSD 10.1/10.2 32bit/64bit platform
  • Description updated (diff)
Actions #2

Updated by Alex Afanasyev over 8 years ago

I have checked compilation on 10.2 64bit platform with clang 3.7 and errors do not exist.

I declare this as a clang bug, but what should be the action? Update slave to use more recent / the most recent clang version?

Actions #3

Updated by Junxiao Shi over 8 years ago

Is there a relevant bug report on LLVM bug tracker?

Actions #4

Updated by Alex Afanasyev over 8 years ago

I'm not sure how to search for this bug. I can try to look, but it may not be worth spending time, given the issue does not manifest itself in the latest version of clang.

Actions #5

Updated by Alex Afanasyev over 8 years ago

Looks like this bug: https://llvm.org/bugs/show_bug.cgi?id=15365. The proposed fix in the bug report is exactly the same as what I have tried in ndn-cxx.

Actions #6

Updated by Alex Afanasyev over 8 years ago

  • Status changed from New to Closed
  • Assignee set to Alex Afanasyev

Solution to this issue: use the recent version of clang. For example:

sudo pkg install clang37
CXX=clang++37 ./waf configure
Actions #7

Updated by Davide Pesavento 6 months ago

  • Tags set to FreeBSD
Actions

Also available in: Atom PDF