cpp-ipc icon indicating copy to clipboard operation
cpp-ipc copied to clipboard

fail: send, there is no receiver on this connection.

Open hobin0920 opened this issue 3 years ago • 8 comments

Hi, While I use this demo code, I found if the received crashed and reopen it again, I usually get this error and can not get any message anymore, I need to reboot my device to recovery it. is it the exist issue or limitation? or anything I need to handle on the code?

[code version] commit 647f7a2efb1ffc1015770026c76e3fe66e46a074 [Step]

  1. launch process A
  2. launch process B
  3. process B crashed
  4. reopen process B

hobin0920 avatar Jun 03 '21 01:06 hobin0920

Yes, it is a defect. There is a certain probability that a working connection will be closed while cleaning up invalid connections. I'm thinking of some solutions to this problem.

mutouyun avatar Jun 04 '21 14:06 mutouyun

Yes, it is a defect. There is a certain probability that a working connection will be closed while cleaning up invalid connections. I'm thinking of some solutions to this problem.

https://squadrick.dev/journal/ipc-locks.html 是否考虑参考这个文章改善异常退出锁释放问题?

http://man7.org/linux/man-pages/man3/pthread_mutexattr_setrobust.3.html If a mutex is initialized with the PTHREAD_MUTEX_ROBUST attribute and its owner dies without unlocking it, any future attempts to call pthread_mutex_lock on this mutex will succeed and return EOWNERDEAD to indicate that the original owner no longer exists and the mutex is in an inconsistent state. Usually after EOWNERDEAD is returned, the next owner should call pthread_mutex_consistent on the acquired mutex to make it consistent again before using it any further.

pi1ot avatar Sep 08 '21 03:09 pi1ot

木老师,我遇到了这个问题,下次启动的时候仍然是这样,我需要怎么做才能使它正常

ahao1995 avatar Nov 17 '21 15:11 ahao1995

是因为锁异常导致的问题么? 你可以尝试下develop分支下的代码,在那个里面我尝试了robust的锁和条件变量。 如果还有问题,还请及时告知我,谢谢~

mutouyun avatar Nov 18 '21 16:11 mutouyun

木老师,我尝试了最新的develop代码,依然跑不起来,显示同样的错误,我将/dev/shm下的所有文件删除后依然存在这个问题,可能的问题出现在哪里

ahao1995 avatar Nov 22 '21 08:11 ahao1995

木老师,我尝试了最新的develop代码,依然跑不起来,显示同样的错误,我将/dev/shm下的所有文件删除后依然存在这个问题,可能的问题出现在哪里

建议提供一下可以复现问题的最小代码。

pi1ot avatar Nov 23 '21 06:11 pi1ot

/dev/shm下的所有文件删除后依然存在这个问题?这不应该啊…… 我估计12月可能能有时间正式开始对应这一系列严重bug。

mutouyun avatar Nov 23 '21 09:11 mutouyun

我再次尝试了下,可以了,应该是我之前搞错了,打扰木老师了

ahao1995 avatar Nov 23 '21 10:11 ahao1995