cryptobiu / MATRIX

MPC Simulation Framework
MIT License
24 stars 13 forks source link

fabfile: killall fails to kill old process #5

Closed lenerd closed 6 years ago

lenerd commented 6 years ago

In the fabfile.py, https://github.com/cryptobiu/MATRIX/blob/174fc07539be07b3bcffd8afc988d6dbb17ae742/Execution/fabfile.py#L75-L76 when executing a protocol, it tries to kill any old instances with killall.

However, in this case it fails since run.sh does not seem to be part of the process name.

Using pkill innerproduct or pkill with -f works from the shell (-f looks into the process's command line). But if we use pkill -f in the fabfile.py we kill "ourself".

$ ps aux | grep run.sh
lbraun   21988  0.0  0.0  11140  3392 ?        Ss   14:54   0:00 /bin/bash -l -c cd /home/lbraun/cryptobiu-ABY/MATRIX >/dev/null && . ./run.sh 0 -b 32
Choose task to be executed:
1. Preform pre process operations
2. Install Experiment
3. Execute Experiment
4. Update libscapi
Your choice:3
[127.0.0.1] Executing task 'run_protocol'
[127.0.0.1] sudo: killall -9 run.sh; exit 0
[127.0.0.1] out: run.sh: no process found
[127.0.0.1] out: 

[127.0.0.1] sudo: ldconfig ~/boost_1_64_0/stage/lib/ ~/libscapi/install/lib/
[127.0.0.1] run: pwd
[127.0.0.1] out: /home/lbraun/cryptobiu-ABY/MATRIX
[127.0.0.1] out: 

[127.0.0.1] put: InstancesConfigurations/parties.conf -> /home/lbraun/cryptobiu-ABY/MATRIX/parties.conf
[127.0.0.1] run: . ./run.sh 0 -b 32 
[127.0.0.1] out: Listen failed
[127.0.0.1] out: Error: a socket could not be bound
[127.0.0.1] out: There was an error during establish connection, ending!
lenerd commented 6 years ago

I still get warnings, e.g.,

Warning: sudo() received nonzero return code -1 while executing 'kill -9 `ps aux | grep YaoSingleExecution | awk '{print $2}'`'!

kill should return with 1 (not -1) if it fails (see manpage).

When executing the ps/grep part, I also get the grep process itself. Maybe that is part of the problem.

$ ps aux | grep YaoSingleExecution
lennart  30166  0.0  0.0   8516  2448 pts/0    S+   14:52   0:00 grep YaoSingleExecution