Bug 214470 - dns/powerdns-recursor: crashes with boost 1.62
Summary: dns/powerdns-recursor: crashes with boost 1.62
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: crash, needs-patch, regression
Depends on:
Blocks: 199601
  Show dependency treegraph
 
Reported: 2016-11-13 10:47 UTC by Jan Beich
Modified: 2016-11-24 02:37 UTC (History)
1 user (show)

See Also:
tremere: maintainer-feedback+


Attachments
partial fix (6.48 KB, patch)
2016-11-20 03:30 UTC, Jan Beich
no flags Details | Diff
partial fix, v2 (7.59 KB, patch)
2016-11-20 04:33 UTC, Jan Beich
no flags Details | Diff
std::string workaround (7.59 KB, patch)
2016-11-21 04:45 UTC, Jan Beich
no flags Details | Diff
std::string workaround (1.93 KB, patch)
2016-11-21 04:47 UTC, Jan Beich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2016-11-13 10:47:28 UTC
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:33:7: error: no member named 'make_fcontext' in namespace 'boost::context'; did you mean 'boost::context::detail::make_fcontext'?
using boost::context::make_fcontext;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      boost::context::detail::make_fcontext
/usr/local/include/boost/context/detail/fcontext.hpp:33:35: note: 'boost::context::detail::make_fcontext' declared here
fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) );
                                  ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:64:7: error: no member named 'fcontext_t' in namespace 'boost::context'; did you mean 'boost::context::detail::fcontext_t'?
using boost::context::fcontext_t;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      boost::context::detail::fcontext_t
/usr/local/include/boost/context/detail/fcontext.hpp:23:17: note: 'boost::context::detail::fcontext_t' declared here
typedef void*   fcontext_t;
                ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:65:7: error: no member named 'jump_fcontext' in namespace 'boost::context'; did you mean 'boost::context::detail::jump_fcontext'?
using boost::context::jump_fcontext;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      boost::context::detail::jump_fcontext
/usr/local/include/boost/context/detail/fcontext.hpp:31:35: note: 'boost::context::detail::jump_fcontext' declared here
transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp);
                                  ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:96:5: error: no matching function for call to 'jump_fcontext'
    jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
    ^~~~~~~~~~~~~
/usr/local/include/boost/context/detail/fcontext.hpp:31:35: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp);
                                  ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:109:5: error: no matching function for call to 'jump_fcontext'
    jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
    ^~~~~~~~~~~~~
/usr/local/include/boost/context/detail/fcontext.hpp:31:35: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp);
                                  ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:132:9: error: no matching function for call to 'jump_fcontext'
    if (jump_fcontext (reinterpret_cast<fcontext_t*>(&octx.uc_mcontext),
        ^~~~~~~~~~~~~
/usr/local/include/boost/context/detail/fcontext.hpp:31:35: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp);
                                  ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:144:23: error: no matching function for call to 'make_fcontext'
    ctx.uc_mcontext = make_fcontext (&ctx.uc_stack[ctx.uc_stack.size()],
                      ^~~~~~~~~~~~~
/usr/local/include/boost/context/detail/fcontext.hpp:33:35: note: candidate function not viable: no known conversion from 'void (*)(const intptr_t)' (aka 'void (*)(const int)') to 'void (*)(boost::context::detail::transfer_t)' for 3rd argument
fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) );
                                  ^
In file included from mtasker_context.cc:27:
./mtasker_fcontext.cc:149:5: error: no matching function for call to 'jump_fcontext'
    jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
    ^~~~~~~~~~~~~
/usr/local/include/boost/context/detail/fcontext.hpp:31:35: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp);
                                  ^
8 errors generated.
Comment 1 Antoine Brodin freebsd_committer 2016-11-19 22:48:52 UTC
Recent commits from https://github.com/PowerDNS/pdns/commits/master/pdns/mtasker_fcontext.cc may help.
Comment 2 Jan Beich freebsd_committer 2016-11-20 03:30:40 UTC
Created attachment 177195 [details]
partial fix

(In reply to Antoine Brodin from comment #1)
poudriere bulk -t is green for head-amd64 + boost 1.55 (current), 10.1 i386 + boost 1.62 (upcoming)

Beware, runtime may crash with boost 1.62.

  Assertion failed: (this != &x), function operator=, file /usr/local/include/boost/container/string.hpp, line 830.
  (lldb) bt
  * thread #4: tid = 100838, 0x0000000802e66fea libc.so.7`thr_kill + 10 at thr_kill.S:3, stop reason =signal SIGABRT
    * frame #0: 0x0000000802e66fea libc.so.7`thr_kill + 10 at thr_kill.S:3
      frame #1: 0x0000000802e66fbb libc.so.7`__raise(s=6) + 59 at raise.c:52
      frame #2: 0x0000000802e66f29 libc.so.7`abort + 73 at abort.c:65
      frame #3: 0x0000000802eebfa1 libc.so.7`__assert(func=<unavailable>, file=<unavailable>, line=<unavailable>, failedexpr=<unavailable>) + 81 at assert.c:51
      frame #4: 0x000000000045a206 pdns_recursor`boost::container::basic_string<char, std::__1::char_traits<char>, boost::container::new_allocator<char> >::operator=(this=0x0000000804190048, x=0x0000000804190048) + 70 at string.hpp:830
      frame #5: 0x000000000047adaf pdns_recursor`DNSName::operator=(this=0x0000000804190048, (null)=0x0000000804190048) + 47 at dnsname.hh:63
      frame #6: 0x000000000092f799 pdns_recursor`void std::__1::random_shuffle<std::__1::__wrap_iter<DNSName*>, unsigned int (&)(unsigned int)>(std::__1::__wrap_iter<DNSName*>, std::__1::__wrap_iter<DNSName*>, unsigned int (&&&)(unsigned int)) [inlined] std::__1::enable_if<(is_move_constructible<DNSName>::value) && (is_move_assignable<DNSName>::value), void>::type std::__1::swap<DNSName>(__x=0x0000000804190048, __y=0x0000000804190048) + 59 at type_traits:4422
      frame #7: 0x000000000092f75e pdns_recursor`void std::__1::random_shuffle<std::__1::__wrap_iter<DNSName*>, unsigned int (&)(unsigned int)>(__first=__wrap_iter<DNSName *> @ 0x000000080417db38, __last=__wrap_iter<DNSName *> @ 0x000000080417db30, __rand=0x000000000044d8a0)(unsigned int)) + 398 at algorithm:3126
      frame #8: 0x0000000000928630 pdns_recursor`SyncRes::shuffleInSpeedOrder(this=0x00000008041888a0,tnameservers=0x0000000804187040, prefix=0x0000000804182350) + 2480 at syncres.cc:890
      frame #9: 0x00000000009092ff pdns_recursor`SyncRes::doResolveAt(this=0x00000008041888a0, nameservers=0x0000000804187040, auth=DNSName @ 0x0000000804187710, flawedNSSet=false, qname=0x0000000804188888, qtype=0x0000000804188448, ret=0x0000000804188450, depth=0, beenthere=0x0000000804187910) + 7807 at syncres.cc:987
      frame #10: 0x00000000008fb5ce pdns_recursor`SyncRes::doResolve(this=0x00000008041888a0, qname=0x0000000804188888, qtype=0x0000000804188448, ret=0x0000000804188450, depth=0, beenthere=0x0000000804187910) + 7726 at syncres.cc:470
      frame #11: 0x00000000008f9707 pdns_recursor`SyncRes::beginResolve(this=0x00000008041888a0, qname=0x0000000804188888, qtype=0x0000000804188448, qclass=1, ret=0x0000000804188450) + 7015 at syncres.cc:180
      frame #12: 0x000000000076dae7 pdns_recursor`houseKeeping((null)=0x0000000000000000) + 2903 at pdns_recursor.cc:1918
      frame #13: 0x00000000007aa850 pdns_recursor`MTasker<PacketID, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::makeThread(this=0x0000000804188b90)(void*), void*)::'lambda'()::operator()() const + 128 at mtasker.cc:270
      frame #14: 0x00000000007aa58d pdns_recursor`boost::detail::function::void_function_obj_invoker0<MTasker<PacketID, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> >::makeThread(void (*)(void*), void*)::'lambda'(), void>::invoke(function_obj_ptr=0x0000000804188b90) + 29 at function_template.hpp:159
      frame #15: 0x0000000000710a78 pdns_recursor`boost::function0<void>::operator(this=0x0000000804188b88)() const + 120 at function_template.hpp:770
      frame #16: 0x0000000000710742 pdns_recursor`threadWrapper(t=(fctx = 0x00007fffdfbfa978, data = 0x00007fffdfbfa9c8)) + 146 at mtasker_fcontext.cc:133
      frame #17: 0x00000008016b675b libboost_context.so.1.62.0`make_fcontext + 27


or inside 103amd64 jail with just boost-libs and powerdns-recursor built WITH_DEBUG=1

  Assertion failed: (this != &x), function operator=, file /usr/local/include/boost/container/string.hpp, line 830.
  [New LWP 100673 of process 63088]
  [New LWP 100672 of process 63088]
  [New LWP 100684 of process 63088]

  Thread 2 received signal SIGABRT, Aborted.
  [Switching to LWP 100673 of process 63088]
  0x00000008024cf35a in thr_kill () from /lib/libc.so.7
  (gdb) bt
  #0  0x00000008024cf35a in thr_kill () from /lib/libc.so.7
  #1  0x00000008024cf346 in raise () from /lib/libc.so.7
  #2  0x00000008024cf2c9 in abort () from /lib/libc.so.7
  #3  0x0000000802535f91 in __assert () from /lib/libc.so.7
  #4  0x00000000005d259f in boost::container::basic_string<char, std::__1::char_traits<char>, boost::container::new_allocator<char> >::operator=(boost::container::basic_string<char, std::__1::char_traits<char>, boost::container::new_allocator<char> >&&) (this=<optimized out>, x=<optimized out>)
      at /usr/local/include/boost/container/string.hpp:830
  #5  DNSName::operator=(DNSName&&) (this=<optimized out>) at ./dnsname.hh:63
  #6  std::__1::swap<DNSName> (__x=..., __y=...) at /usr/include/c++/v1/type_traits:3563
  #7  std::__1::random_shuffle<std::__1::__wrap_iter<DNSName*>, unsigned int (&)(unsigned int)> (
      __rand=<optimized out>, __first=..., __last=...) at /usr/include/c++/v1/algorithm:3115
  #8  0x00000000005ca509 in SyncRes::shuffleInSpeedOrder (this=0x80395aa28, tnameservers=...,
      prefix=...) at syncres.cc:890
  #9  0x00000000005bac6a in SyncRes::doResolveAt (this=0x80395aa28, nameservers=..., auth=...,
      flawedNSSet=<optimized out>, qname=..., qtype=..., ret=..., depth=<optimized out>,
      beenthere=...) at syncres.cc:987
  #10 0x00000000005b3242 in SyncRes::doResolve (this=0x80395aa28, qname=..., qtype=..., ret=...,
      depth=0, beenthere=...) at syncres.cc:470
  #11 0x00000000005b1680 in SyncRes::beginResolve (this=0x80395aa28, qname=..., qtype=...,
      qclass=<optimized out>, ret=...) at syncres.cc:180
  #12 0x00000000005467ff in houseKeeping () at pdns_recursor.cc:1918
  #13 0x0000000000559f91 in operator() (this=0x80395acf0) at ./mtasker.cc:270
  #14 0x0000000000523b91 in boost::function0<void>::operator() (this=<optimized out>,
      this=<optimized out>) at /usr/local/include/boost/function/function_template.hpp:770
  #15 threadWrapper (t=...) at ./mtasker_fcontext.cc:133
  #16 0x00000008010822ab in make_fcontext () at libs/context/src/asm/make_x86_64_sysv_elf_gas.S:51
  #17 0x0000000000000000 in ?? ()
Comment 3 Jan Beich freebsd_committer 2016-11-20 04:33:03 UTC
Created attachment 177198 [details]
partial fix, v2

I guess https://github.com/PowerDNS/pdns/issues/2955 affects other systems using libc++.
Comment 4 Jan Beich freebsd_committer 2016-11-20 17:39:32 UTC
Comment on attachment 177198 [details]
partial fix, v2

Nevermind, while 10.3 amd64 starts fine 10.1 i386 crashes.
Comment 5 commit-hook freebsd_committer 2016-11-21 04:21:34 UTC
A commit references this bug:

Author: jbeich
Date: Mon Nov 21 04:21:20 UTC 2016
New revision: 426688
URL: https://svnweb.freebsd.org/changeset/ports/426688

Log:
  dns/powerdns-recursor: unbreak build with boost 1.62

  In file included from mtasker_context.cc:27:
  ./mtasker_fcontext.cc:33:7: error: no member named 'make_fcontext' in namespace 'boost::context'; did you mean 'boost::context::detail::make_fcontext'?
  using boost::context::make_fcontext;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from mtasker_context.cc:27:
  ./mtasker_fcontext.cc:64:7: error: no member named 'fcontext_t' in namespace 'boost::context'; did you mean 'boost::context::detail::fcontext_t'?
  using boost::context::fcontext_t;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
  [...]

  PR:		214470
  Submitted by:	antoine
  Obtained from:	upstream
  Approved by:	portmgr blanket

Changes:
  head/dns/powerdns-recursor/files/patch-mtasker__fcontext.cc
Comment 6 Jan Beich freebsd_committer 2016-11-21 04:45:22 UTC
Created attachment 177222 [details]
std::string workaround

The build fix which is nop for boost 1.55 (current) has landed. This attachment only tries to fix the crash in comment 2 now.
Comment 7 Jan Beich freebsd_committer 2016-11-21 04:47:15 UTC
Created attachment 177223 [details]
std::string workaround

Oops, attached the wrong file.
Comment 8 Ralf van der Enden 2016-11-23 21:45:22 UTC
(In reply to Jan Beich (mail not working) from comment #7)
I can confirm the std::string fix works. Was working on a patch myself (hadn't seen this one) and patched it a little bit different. Instead of changing the __APPLE__ into __LIBCPP_VERSION__ I added '&& ! defined(__FreeBSD__)'.

But obviously it works out the same.
Comment 9 commit-hook freebsd_committer 2016-11-24 02:31:16 UTC
A commit references this bug:

Author: jbeich
Date: Thu Nov 24 02:30:22 UTC 2016
New revision: 426987
URL: https://svnweb.freebsd.org/changeset/ports/426987

Log:
  dns/powerdns-recursor: work around crash with boost 1.62

  Assertion failed: (this != &x), function operator=, file /usr/local/include/boost/container/string.hpp, line 830.

  PR:		214470
  Approved by:	Ralf van der Enden <tremere@cainites.net> (maintainer)

Changes:
  head/dns/powerdns-recursor/Makefile
  head/dns/powerdns-recursor/files/patch-dnsname.hh