-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
在android上mars::stn消息队列线程被阻塞的问题 #214
Comments
是mobile网络还是WiFi?是否处于锁屏状态? |
Wifi下, 没有锁屏 |
阻塞之前, netlink_recv(p_socket, l_buffer, l_size) 最后收到的一组数据的长度是20, 这个 nlmsghdr |
GetDetailNetInfo()函数阻塞在你的机型是必须吗? |
在comm/jni/ifaddrs.c的getNetlinkResponse函数中下面的语句有bug: netlink的文档上说, nlmsg_pid与process id并没有1:1的对应关系。
nlmsg_pid 的值实际上是bind的时候kernel为socket自动分配的nl_pid。
所以,对于不同的netlink socket, nlmsg_pid是不同的,我们不能把它和process id比较。 |
@elviswoo GetDetailNetInfo()函数阻塞在特定条件下是必现的。 条件就是其它的so库中的代码也创建了一个netlink socket,并将该socket bind到默认地址,并且没有关闭该socket。这种条件下再调用 GetDetailNetInfo()就会阻塞。 |
我们用Mars开发IM功能,在调用StnLogic.reset();之后, 新创建的NetCore实例在消息队列线程执行
xinfo2(TSF"net info:%_", GetDetailNetInfo());
时,GetDetailNetInfo()
导致消息队列线程被阻塞, 阻塞在 netlink_recv ifaddrs.c的104行的 recvmsg 调用。调用栈的顶部部分如下:
netlink_recv ifaddrs.c:104
getNetlinkResponse ifaddrs.c:137
getResultList ifaddrs.c:213
getifaddrs ifaddrs.c:626
getifaddrs_ipv4_filter(std::vector<ifaddrinfo_ip_t, std::allocator<ifaddrinfo_ip_t> >&, unsigned int) getifaddrs.cc:141
GetDetailNetInfo() netinfo_util.cc:99
mars::stn::NetCore::NetCore()::$_0::operator()() const net_core.cc:156
...
在阻塞之前 getNetlinkResponse 已经读出了多次数据,最后一次读出的数据长度为20,但是都没有将p_done为1。
机型: Hisense F31, Android 6.0.1, Vision 3系统
The text was updated successfully, but these errors were encountered: