Command stuck when using net/rpc & exec.Command

99 views
Skip to first unread message

ChrisFisher

unread,
Nov 19, 2021, 11:30:45 AM11/19/21
to golang-nuts
Hey Guys, I want to do a micro benchmark, and I have one master machine and one worker machine. The master machine sends out rpcs concurrently to the worker, and after the worker receive the rpc, it starts to do some commands using exec.Command. Here are parts of my code. master code and, worker code. I use a channel of size 12 to simulate there are only 12 threads in worker machine. But the whole procedure stuck at the point of 
cmd.Run() and I don't know why because the command is just simply echo a hello. I did some experiments on rpc and exec.Command, they worked out perfectly without each other. But when I combined them, it stuck. I don't know, does anyone know what happen?

Kurtis Rader

unread,
Nov 19, 2021, 9:32:25 PM11/19/21
to ChrisFisher, golang-nuts
On Fri, Nov 19, 2021 at 8:30 AM ChrisFisher <yangfi...@gmail.com> wrote:
Hey Guys, I want to do a micro benchmark, and I have one master machine and one worker machine. The master machine sends out rpcs concurrently to the worker, and after the worker receive the rpc, it starts to do some commands using exec.Command. Here are parts of my code. master code and, worker code. I use a channel of size 12 to simulate there are only 12 threads in worker machine. But the whole procedure stuck at the point of 
cmd.Run() and I don't know why because the command is just simply echo a hello. I did some experiments on rpc and exec.Command, they worked out perfectly without each other. But when I combined them, it stuck. I don't know, does anyone know what happen?

Insufficient data since your playground worker example does not include the rpc components or a `main()` function. I would start by killing the worker process with SIGABRT. That should produce Go stack traces which are likely to provide useful clues.

--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

宇晗杨

unread,
Nov 21, 2021, 3:15:11 AM11/21/21
to Kurtis Rader, golang-nuts
Got it. I found that I forgot to add `time.Sleep` in `main()` function so there would be some schedule problem, now I fix the problem. Thanks.
Reply all
Reply to author
Forward
0 new messages