We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ubuntu 16.04 使用的是muduo c++11版
目的在没有接收到信息超过2分钟后,会调用forceClose强制断开连接,然后收到注册的连接回调函数的断联消息后,就会崩溃,初步分析只有在发命令的时候偶尔会发生这种情况,在没有发命令的时候,没有出现过,现在我的处理是:在准备关闭连接之前提早将连接标志位置false,使得不会在发送命令,过几秒后,再调用forceClose函数。
崩溃函数: void EPollPoller::updateChannel(Channel* channel) { Poller::assertInLoopThread(); const int index = channel->index(); if (index == kNew || index == kDeleted) { // a new one, add with EPOLL_CTL_ADD int fd = channel->fd(); if (index == kNew) { assert(channels_.find(fd) == channels_.end()); channels_[fd] = channel; } else // index == kDeleted { assert(channels_.find(fd) != channels_.end()); assert(channels_[fd] == channel); }
channel->set_index(kAdded); update(EPOLL_CTL_ADD, channel);
} else { // update existing one with EPOLL_CTL_MOD/DEL int fd = channel->fd(); (void)fd; assert(channels_.find(fd) != channels_.end()); assert(channels_[fd] == channel); assert(index == kAdded); if (channel->isNoneEvent()) { update(EPOLL_CTL_DEL, channel); channel->set_index(kDeleted); } else { update(EPOLL_CTL_MOD, channel); } } }
coredump信息堆栈如下: *** Aborted at 1657443526 (unix time) try "date -d @1657443526" if you are using GNU date *** PC: @ 0x0 (unknown) *** SIGABRT (@0x7a2) received by PID 1954 (TID 0x7f422cff9700) from PID 1954; stack trace: *** @ 0x7f423aaee980 (unknown) @ 0x7f4239deafb7 gsignal @ 0x7f4239dec921 abort @ 0x7f4239ddc48a (unknown) @ 0x7f4239ddc502 __assert_fail @ 0x7f423e24640c yuto::net::EPollPoller::updateChannel() @ 0x7f423e24c014 yuto::net::Connector::connecting() @ 0x7f423e24fea9 yuto::net::TcpClient::removeConnection() @ 0x7f423e249672 yuto::net::TcpConnection::handleClose() @ 0x7f423e2420b9 yuto::net::EventLoop::doPendingFunctors() @ 0x7f423e242249 yuto::net::EventLoop::loop() @ 0x7f423a810a50 (unknown) @ 0x7f423aae36db start_thread @ 0x7f4239ecd71f clone @ 0x0 (unknown)
The text was updated successfully, but these errors were encountered:
Please provide a SSCCE: Short, Self Contained, Correct (Compilable), Example.
Sorry, something went wrong.
不一定出现,我自己测试的时候多线程一边forceClose 一边发送消息 也没出现…………
不一定出现不要紧。至少要有一个完整的能运行的程序,不然光凭文字描述我很难复现你遇到的场景。
另外,我不认识 yuto::net 这个 namespace,如果你用的不是 muduo 库本尊,请考虑把 issue 提到 yuto 库那里。
yuto::net
yuto
No branches or pull requests
ubuntu 16.04 使用的是muduo c++11版
目的在没有接收到信息超过2分钟后,会调用forceClose强制断开连接,然后收到注册的连接回调函数的断联消息后,就会崩溃,初步分析只有在发命令的时候偶尔会发生这种情况,在没有发命令的时候,没有出现过,现在我的处理是:在准备关闭连接之前提早将连接标志位置false,使得不会在发送命令,过几秒后,再调用forceClose函数。
崩溃函数:
void EPollPoller::updateChannel(Channel* channel)
{
Poller::assertInLoopThread();
const int index = channel->index();
if (index == kNew || index == kDeleted)
{
// a new one, add with EPOLL_CTL_ADD
int fd = channel->fd();
if (index == kNew)
{
assert(channels_.find(fd) == channels_.end());
channels_[fd] = channel;
}
else // index == kDeleted
{
assert(channels_.find(fd) != channels_.end());
assert(channels_[fd] == channel);
}
}
else
{
// update existing one with EPOLL_CTL_MOD/DEL
int fd = channel->fd();
(void)fd;
assert(channels_.find(fd) != channels_.end());
assert(channels_[fd] == channel);
assert(index == kAdded);
if (channel->isNoneEvent())
{
update(EPOLL_CTL_DEL, channel);
channel->set_index(kDeleted);
}
else
{
update(EPOLL_CTL_MOD, channel);
}
}
}
coredump信息堆栈如下:
*** Aborted at 1657443526 (unix time) try "date -d @1657443526" if you are using GNU date ***
PC: @ 0x0 (unknown)
*** SIGABRT (@0x7a2) received by PID 1954 (TID 0x7f422cff9700) from PID 1954; stack trace: ***
@ 0x7f423aaee980 (unknown)
@ 0x7f4239deafb7 gsignal
@ 0x7f4239dec921 abort
@ 0x7f4239ddc48a (unknown)
@ 0x7f4239ddc502 __assert_fail
@ 0x7f423e24640c yuto::net::EPollPoller::updateChannel()
@ 0x7f423e24c014 yuto::net::Connector::connecting()
@ 0x7f423e24fea9 yuto::net::TcpClient::removeConnection()
@ 0x7f423e249672 yuto::net::TcpConnection::handleClose()
@ 0x7f423e2420b9 yuto::net::EventLoop::doPendingFunctors()
@ 0x7f423e242249 yuto::net::EventLoop::loop()
@ 0x7f423a810a50 (unknown)
@ 0x7f423aae36db start_thread
@ 0x7f4239ecd71f clone
@ 0x0 (unknown)
The text was updated successfully, but these errors were encountered: