Reputation: 1
There have an named pipe between parent and child process, child is writer, parent is reader. Parent create this named pipe as below: os.mknod(events_pipe_file, 0o600 | stat.S_IFIFO)
And pass this events_pipe_file to child, tell child writes events in this named pipe.
parent open this pipe and read as below: event_stream = io.FileIO(self._events_file, "r") for line in event_stream: ....
At the beginning, everything goes well, about 2 hours later, parent can not read anything from this named pipe. I checked child log, it is still writing events in this named pipe normally until finish its work, and then child wants to exit, but parent get stuck in reading, then, this child become zombie.
I don't understand, what probable reason caused parent get stuck in reading from named pipe? And I don't know how to debug this issue?
Expect parent read normally, when child finish its work, and exit, parent exit normally.
I was thinking parent get stuck could be some memory limitation, since I need to save some data in memory.
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 255387
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 8192
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 255387
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
parent process:
$ pmap -x 464257|tail -f
00007f6d78532000 28 28 0 r--s- gconv-modules.cache
00007f6d78539000 8 8 8 rw--- [ anon ]
00007f6d7853b000 4 4 4 r---- ld-2.28.so
00007f6d7853c000 8 8 8 rw--- ld-2.28.so
00007ffe56d91000 136 84 84 rw--- [ stack ]
00007ffe56de2000 16 0 0 r---- [ anon ]
00007ffe56de6000 8 4 0 r-x-- [ anon ]
ffffffffff600000 4 0 0 r-x-- [ anon ]
---------------- ------- ------- -------
total kB 397260 65636 48660
Do not make sense about the memory.
Upvotes: 0
Views: 18
Reputation: 1
The problem has been solved.
The root cause is not in parent and child, that named pipe also worked very well. The problem is that parent actually is a child too, it starts by another process by using subprocess.Popen(). Then, actually, we have a grandparent, parent, child. Between grandparent and parent, we have a pipe to communicate with each other, parent writes in it, and grandparent reads from it. This pipe get filled, then parent get blocked when writing, it can not read message from that named pipe as well.
Upvotes: 0