[ 
https://issues.apache.org/jira/browse/KUDU-2022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hao Hao updated KUDU-2022:
--------------------------
    Code Review: https://gerrit.cloudera.org/#/c/6932/

> Commit c178563 breaks many unit tests on my laptop
> --------------------------------------------------
>
>                 Key: KUDU-2022
>                 URL: https://issues.apache.org/jira/browse/KUDU-2022
>             Project: Kudu
>          Issue Type: Bug
>          Components: rpc
>    Affects Versions: 1.4.0
>            Reporter: Adar Dembo
>            Assignee: Hao Hao
>            Priority: Blocker
>
> If I check out this commit, I get the following failure when I run 
> client-test in ASAN:
> {noformat}
> I0519 13:01:06.263177 23090 webserver.cc:270] Webserver started. Bound to: 
> http://0.0.0.0:35335/
> /home/adar/Source/kudu/src/kudu/util/net/net_util.cc:281:24: runtime error: 
> member access within null pointer of type 'struct sockaddr'
> SUMMARY: AddressSanitizer: undefined-behavior 
> /home/adar/Source/kudu/src/kudu/util/net/net_util.cc:281:24 in 
> {noformat}
> And for a DEBUG build:
> {noformat}
> I0519 13:10:43.328088 20967 webserver.cc:270] Webserver started. Bound to: 
> http://0.0.0.0:33180/
> *** Aborted at 1495224643 (unix time) try "date -d @1495224643" if you are 
> using GNU date ***
> PC: @     0x7fc0d2044d30 kudu::GetLocalNetworks()
> *** SIGSEGV (@0x0) received by PID 20967 (TID 0x7fbf867bc700) from PID 0; 
> stack trace: ***
>     @     0x7fc0d2412390 (unknown)
>     @     0x7fc0d2044d30 kudu::GetLocalNetworks()
>     @     0x7fc0d27e01a0 
> _ZZN4kudu3rpc17ServerNegotiation19IsTrustedConnectionERKNS_8SockaddrEENKUlvE_clEv
>     @     0x7fc0d27e1552 
> _ZNSt12_Bind_simpleIFZN4kudu3rpc17ServerNegotiation19IsTrustedConnectionERKNS0_8SockaddrEEUlvE_vEE9_M_invokeIJEEEvSt12_Index_tupleIJXspT_EEE
>     @     0x7fc0d27e143c 
> _ZNSt12_Bind_simpleIFZN4kudu3rpc17ServerNegotiation19IsTrustedConnectionERKNS0_8SockaddrEEUlvE_vEEclEv
>     @     0x7fc0d27e0e2e 
> _ZSt16__once_call_implISt12_Bind_simpleIFZN4kudu3rpc17ServerNegotiation19IsTrustedConnectionERKNS1_8SockaddrEEUlvE_vEEEvv
>     @     0x7fc0d240fa99 __pthread_once_slow
>     @     0x7fc0d27d702d __gthread_once()
>     @     0x7fc0d27e07d6 
> _ZSt9call_onceIZN4kudu3rpc17ServerNegotiation19IsTrustedConnectionERKNS0_8SockaddrEEUlvE_JEEvRSt9once_flagOT_DpOT0_
>     @     0x7fc0d27e0425 kudu::rpc::ServerNegotiation::IsTrustedConnection()
>     @     0x7fc0d27ddeb1 kudu::rpc::ServerNegotiation::HandleSaslInitiate()
>     @     0x7fc0d27dbfd2 kudu::rpc::ServerNegotiation::AuthenticateBySasl()
>     @     0x7fc0d27d83de kudu::rpc::ServerNegotiation::Negotiate()
>     @     0x7fc0d279792f kudu::rpc::DoServerNegotiation()
>     @     0x7fc0d2797cb0 kudu::rpc::Negotiation::RunNegotiation()
>     @     0x7fc0d27af743 kudu::internal::RunnableAdapter<>::Run()
>     @     0x7fc0d27ae4e9 kudu::internal::InvokeHelper<>::MakeItSo()
>     @     0x7fc0d27acd64 kudu::internal::Invoker<>::Run()
>     @     0x7fc0d2a441b0 kudu::Callback<>::Run()
>     @     0x7fc0d2a48b1d boost::_mfi::cmf0<>::operator()()
>     @     0x7fc0d2a48666 boost::_bi::list1<>::operator()<>()
>     @     0x7fc0d2a47d0e boost::_bi::bind_t<>::operator()()
>     @     0x7fc0d2a47579 
> boost::detail::function::void_function_obj_invoker0<>::invoke()
>     @     0x7fc0d279e81d boost::function0<>::operator()()
>     @     0x7fc0d208c766 kudu::FunctionRunnable::Run()
>     @     0x7fc0d208bbad kudu::ThreadPool::DispatchThread()
>     @     0x7fc0d209052e boost::_mfi::mf1<>::operator()()
>     @     0x7fc0d20900bb boost::_bi::list2<>::operator()<>()
>     @     0x7fc0d208fb2c boost::_bi::bind_t<>::operator()()
>     @     0x7fc0d208f40a 
> boost::detail::function::void_function_obj_invoker0<>::invoke()
>     @     0x7fc0d279e81d boost::function0<>::operator()()
>     @     0x7fc0d208243d kudu::Thread::SuperviseThread()
> Segmentation fault (core dumped)
> {noformat}
> In gdb:
> {noformat}
> Thread 135 "negotiator [wor" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7ffeaa7c4700 (LWP 21306)]
> 0x00007ffff6492d30 in kudu::GetLocalNetworks (net=0x7ffeaa7c28a0)
>     at /home/adar/Source/kudu/src/kudu/util/net/net_util.cc:281
> 281       if (ifa->ifa_addr->sa_family == AF_INET) {
> (gdb) list
> 276                                   errno);
> 277     }
> 278   
> 279     net->clear();
> 280     for (struct ifaddrs *ifa = ifap; ifa; ifa = ifa->ifa_next) {
> 281       if (ifa->ifa_addr->sa_family == AF_INET) {
> 282         Sockaddr addr(*reinterpret_cast<struct 
> sockaddr_in*>(ifa->ifa_addr));
> 283         Sockaddr mask(*reinterpret_cast<struct 
> sockaddr_in*>(ifa->ifa_netmask));
> 284         Network network(addr.addr().sin_addr.s_addr, 
> mask.addr().sin_addr.s_addr);
> 285         net->push_back(network);
> (gdb) p ifa
> $1 = (ifaddrs *) 0x7ffee4003d70
> (gdb) p ifa->ifa_addr
> $2 = (sockaddr *) 0x0
> (gdb) p *ifa
> $3 = {ifa_next = 0x7ffee4003e28, ifa_name = 0x7ffee4003e14 "vpn0", ifa_flags 
> = 4240, ifa_addr = 0x0, 
>   ifa_netmask = 0x0, ifa_ifu = {ifu_broadaddr = 0x0, ifu_dstaddr = 0x0}, 
> ifa_data = 0x7ffee40044a0}
> {noformat}
> The manpage for getifaddrs() says that ifa->ifa_addr may be a null pointer; 
> seems like we're not handling that correctly.
> Here is the output of ifconfig -a on my system:
> {noformat}
> docker0   Link encap:Ethernet  HWaddr 02:42:1d:c8:67:cd  
>           inet addr:10.250.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
>           UP BROADCAST MULTICAST  MTU:1500  Metric:1
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0 
>           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
> eth0      Link encap:Ethernet  HWaddr 54:ee:75:10:ec:00  
>           inet addr:172.21.0.227  Bcast:172.21.3.255  Mask:255.255.252.0
>           inet6 addr: fe80::c404:b182:724:f22f/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:851020 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:237413 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000 
>           RX bytes:604956684 (604.9 MB)  TX bytes:42893606 (42.8 MB)
>           Interrupt:20 Memory:f2600000-f2620000 
> lo        Link encap:Local Loopback  
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           inet6 addr: ::1/128 Scope:Host
>           UP LOOPBACK RUNNING  MTU:65536  Metric:1
>           RX packets:104658 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:104658 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1 
>           RX bytes:33894242 (33.8 MB)  TX bytes:33894242 (33.8 MB)
> vpn0      Link encap:UNSPEC  HWaddr 
> 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
>           POINTOPOINT NOARP MULTICAST  MTU:1406  Metric:1
>           RX packets:126 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:116 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:500 
>           RX bytes:32852 (32.8 KB)  TX bytes:14458 (14.4 KB)
> wlan0     Link encap:Ethernet  HWaddr e8:2a:ea:00:21:f2  
>           inet addr:172.21.1.82  Bcast:172.21.3.255  Mask:255.255.252.0
>           inet6 addr: fe80::ea2a:eaff:fe00:21f2/64 Scope:Link
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:1022550 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:482658 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:1000 
>           RX bytes:683956677 (683.9 MB)  TX bytes:108179952 (108.1 MB)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to