[Xorp-hackers] xorp_fea crashes when interface is removed from OS at in-opportune time.
Ben Greear
greearb at candelatech.com
Mon Oct 22 21:10:30 PDT 2007
This fixes another potential crash due to interface
removal races.
Index: ifconfig_parse_netlink_socket.cc
===================================================================
RCS file: /cvs/xorp/fea/data_plane/ifconfig/ifconfig_parse_netlink_socket.cc,v
retrieving revision 1.11
diff -u -r1.11 ifconfig_parse_netlink_socket.cc
--- ifconfig_parse_netlink_socket.cc 25 Sep 2007 23:00:29 -0000 1.11
+++ ifconfig_parse_netlink_socket.cc 23 Oct 2007 04:08:03 -0000
@@ -447,7 +449,9 @@
// XXX: vifname == ifname on this platform
IfTreeVif* vifp = iftree.find_vif(if_name, if_name);
if (vifp == NULL) {
- XLOG_FATAL("Could not find vif named %s in IfTree", if_name.c_str());
+ XLOG_ERROR("Could not find vif named %s in IfTree, dbg: %i if_index: %i, maybe it was just deleted?",
+ if_name.c_str(), dbg, if_index);
+ return;
}
//
Ben Greear wrote:
> Ben Greear wrote:
>> Seems xorp is very fragile when it comes to adding/deleting
>> interfaces. I think a lot of these errors should just be warnings,
>> not asserts.
>
> And another related to the first:
>
> diff -u -r1.15 fibconfig_entry_set_netlink_socket.cc
> --- fibconfig_entry_set_netlink_socket.cc 12 Oct 2007 07:53:47 -0000 1.15
> +++ fibconfig_entry_set_netlink_socket.cc 20 Oct 2007 03:10:55 -0000
> @@ -256,7 +256,11 @@
> break;
> const IfTree& iftree = fibconfig().iftree();
> const IfTreeInterface* ifp = iftree.find_interface(fte.ifname());
> - XLOG_ASSERT(ifp != NULL);
> + if (!ifp) {
> + XLOG_ERROR("Could not find interface: %s, maybe it was just deleted?\n",
> + fte.ifname().c_str());
> + return XORP_ERROR;
> + }
>
> if (ifp->discard()) {
> rtmsg->rtm_type = RTN_BLACKHOLE;
>
>
> (gdb) bt
> #0 0xffffe410 in __kernel_vsyscall ()
> #1 0x49d42ee9 in raise () from /lib/libc.so.6
> #2 0x49d444f1 in abort () from /lib/libc.so.6
> #3 0x08287669 in xlog_fatal (module_name=Could not find the frame base for "xlog_fatal".
> ) at xlog.c:435
> #4 0x081069a8 in FibConfigEntrySetNetlinkSocket::add_entry (this=0x842ee50, fte=@0x77d9d2d4)
> at fibconfig_entry_set_netlink_socket.cc:259
> #5 0x0810707d in FibConfigEntrySetNetlinkSocket::add_entry4 (this=0x842ee50, fte=@0x8473ee0)
> at fibconfig_entry_set_netlink_socket.cc:100
> #6 0x0807eee4 in FibConfig::add_entry4 (this=0x77da993c, fte=@0x8473ee0) at fibconfig.cc:1077
> #7 0x0805e025 in FibAddEntry4::dispatch (this=0x8473ed8) at fibconfig_transaction.hh:112
> #8 0x082b2387 in TransactionManager::Transaction::commit (this=0x8442eec) at transaction.cc:59
> #9 0x082b0e76 in TransactionManager::commit (this=0x837e910, tid=24373279) at transaction.cc:201
> #10 0x08080684 in FibConfig::commit_transaction (this=0x77da993c, tid=24373279, error_msg=@0x77d9d480)
> at fibconfig.cc:135
> #11 0x080553ad in XrlFeaTarget::redist_transaction4_0_1_commit_transaction (this=0x77daa470, tid=@0x84701bc)
> at xrl_fea_target.cc:2351
> #12 0x0817db00 in XrlFeaTargetBase::handle_redist_transaction4_0_1_commit_transaction (this=0x77daa470,
> xa_inputs=@0x77da14fc) at fea_base.cc:3230
> #13 0x081a894f in XorpMemberCallback2B0<XrlCmdError const, XrlFeaTargetBase, XrlArgs const&, XrlArgs*>::dispatch (
> this=0x8418148, a1=@0x77da14fc, a2=0x77da14e0) at ../../libxorp/callback_nodebug.hh:4615
> #14 0x08256f25 in XrlCmdEntry::dispatch (this=0x84181b4, inputs=@0x77da14fc, outputs=0x77da14e0) at xrl_cmd_map.hh:37
> #15 0x0825da1a in XrlDispatcher::dispatch_xrl (this=0x77da9648, method_name=@0x77da1470, inputs=@0x77da14fc,
> outputs=@0x77da14e0) at xrl_dispatcher.cc:60
> #16 0x08240d19 in XrlRouter::dispatch_xrl (this=0x77da9648, method_name=@0x77da14f8, inputs=@0x77da14fc,
> outputs=@0x77da14e0) at xrl_router.cc:587
> #17 0x08265efd in STCPRequestHandler::dispatch_request (this=0x847dc20, seqno=1249, packed_xrl=0x6fd0987c "?",
> packed_xrl_bytes=101) at xrl_pf_stcp.cc:235
> #18 0x082665d3 in STCPRequestHandler::read_event (this=0x847dc20, ev=BufferedAsyncReader::DATA,
> buffer=0x6fd09864 "STCP\001\001", buffer_bytes=125) at xrl_pf_stcp.cc:199
> #19 0x08267bcc in XorpMemberCallback4B0<void, STCPRequestHandler, BufferedAsyncReader*, BufferedAsyncReader::Event, unsigned char*, unsigned int>::dispatch (this=0x8446dc0, a1=0x847dc28, a2=BufferedAsyncReader::DATA,
> a3=0x6fd09864 "STCP\001\001", a4=125) at ../libxorp/callback_nodebug.hh:8965
> #20 0x0828c0b3 in BufferedAsyncReader::announce_event (this=0x847dc28, ev=BufferedAsyncReader::DATA)
> at buffered_asyncio.cc:248
> #21 0x0828c3f2 in BufferedAsyncReader::io_event (this=0x847dc28, fd={_filedesc = 51}, type=IOT_READ)
> at buffered_asyncio.cc:201
> #22 0x0828cc34 in XorpMemberCallback2B0<void, BufferedAsyncReader, XorpFd, IoEventType>::dispatch (this=0x847ab18, a1=
> {_filedesc = 51}, a2=IOT_READ) at ../libxorp/callback_nodebug.hh:4635
> #23 0x082a8766 in SelectorList::Node::run_hooks (this=0x84750dc, m=SEL_RD, fd={_filedesc = 51}) at selector.cc:149
> #24 0x082a73d1 in SelectorList::wait_and_dispatch (this=0x77daa4e4, timeout=@0x77da95d0) at selector.cc:435
> ---Type <return> to continue, or q <return> to quit---
> #25 0x0828e5a0 in EventLoop::run (this=0x77daa4a8) at eventloop.cc:137
> #26 0x0804d192 in fea_main (finder_hostname=@0x77daa6c0, finder_port=19999) at xorp_fea.cc:101
> #27 0x0804d478 in main (argc=0, argv=0x77daa788) at xorp_fea.cc:175
> (gdb) frame 4
> #4 0x081069a8 in FibConfigEntrySetNetlinkSocket::add_entry (this=0x842ee50, fte=@0x77d9d2d4)
> at fibconfig_entry_set_netlink_socket.cc:259
> 259 fibconfig_entry_set_netlink_socket.cc: No such file or directory.
> in fibconfig_entry_set_netlink_socket.cc
> (gdb) print fte
> $1 = (const FteX &) @0x77d9d2d4: {<Fte<IPvX,IPvXNet>> = {_net = {<IPNet<IPvX>> = {_masked_addr = {_addr = {196874, 0,
> 0, 0}, _af = 2}, _prefix_len = 24}, <No data fields>}, _nexthop = {_addr = {67503114, 0, 0, 0}, _af = 2},
> _ifname = {static npos = 4294967295,
> _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x847c4fc "4.6.6"}}, _vifname = {static npos = 4294967295,
> _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x8444bf4 "4.6.6"}}, _metric = 3, _admin_distance = 110, _xorp_route = true, _is_deleted = false,
> _is_unresolved = false, _is_connected_route = false}, <No data fields>}
> (gdb)
>
>
>
>
>
--
Ben Greear <greearb at candelatech.com>
Candela Technologies Inc http://www.candelatech.com
More information about the Xorp-hackers
mailing list