Skip to content
New issue

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

ipc::channel 在调试模式,打断点,容易会出现,收不到消息的情况,且数据比较大的会出现连接断开的现象; #107

Open
w08 opened this issue Nov 2, 2023 · 5 comments

Comments

@w08
Copy link

w08 commented Nov 2, 2023

无法拿到数据,不好排查;

@w08
Copy link
Author

w08 commented Nov 2, 2023

接收方,一直在这里
typename queue_t::value_t msg {};
if (!wait_for(inf->rd_waiter_, [que, &msg] {
return !que->pop(msg);
}, tm)) {
// pop failed, just return.
return {};------------这里
}
内存如图:
2023 11 02_ f5eb43c848436bb429f242d024a94f91

此时 如果有新的发送方 也不予理会了,收不到数据,建立不了连接。

@mutouyun
Copy link
Owner

mutouyun commented Nov 6, 2023

原因是因为打断点了吗?看起来好像是因为断点导致的超时。周末有空我看看。

@w08
Copy link
Author

w08 commented Nov 6, 2023

是断点导致的,同理 如果 执行太久 数据太多,线程阻塞 应该都会引起这个问题;

@w08
Copy link
Author

w08 commented Nov 8, 2023

原因是因为打断点了吗?看起来好像是因为断点导致的超时。周末有空我看看。

感谢老大

@mutouyun
Copy link
Owner

我查了下,posix里只有pthread_cond_timedwait可以用CLOCK_MONOTONICpthread_mutex_timedlock就不行了;win上WaitForSingleObject也有同样的问题,想解决似乎很麻烦(microsoft/STL#718)。

一个简单的做法是在调试的时候把def.h里的默认超时改成-1

enum : std::uint32_t {
    invalid_value   = (std::numeric_limits<std::uint32_t>::max)(),
    default_timeout = 100, // ms
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants