Add Gunicorn example
I tested this example currently on Ubuntu 22.04 system, I was able to launch the gunicorn app with both gramine-direct and gramine-sgx, but I am not able to kill the process. Everytime I have to hard kill both the child and parent process.
Starting GUNICORN app
$ gramine-sgx gunicorn & echo $! > server.PID
[2] 2979595
$ Gramine is starting. Parsing TOML manifest file, this may take some time...
[2023-11-08 11:05:50 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2023-11-08 11:05:50 +0000] [1] [INFO] Listening at: http://127.0.0.1:8000 (1)
[2023-11-08 11:05:50 +0000] [1] [INFO] Using worker: sync
[2023-11-08 11:05:59 +0000] [2] [INFO] Booting worker with pid: 2
Get the process details and kill it In below steps, we can see how the process is not getting killed, even after trying it multiple times using kill command. Trying to kill both parent process and child process together also does not help. If we just kill parent process, the child process remains active, it does not get killed
$ ps aux | grep gramine
intel 2979595 81.6 0.5 1074314344 44704 pts/1 Sl 16:35 0:10 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so init gunicorn
intel 2979605 100 0.3 26752 24664 pts/1 R 16:35 0:02 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so child 29
intel 2979607 0.0 0.0 9076 2492 pts/2 S+ 16:35 0:00 grep --color=auto gramine
$ cat server.PID
2979595
$ kill $(cat server.PID)
$ ps aux | grep gramine
intel 2979595 25.2 0.5 1074314344 44700 pts/1 Sl 16:35 0:10 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so init gunicorn
intel 2979605 30.2 0.4 1074301800 32164 pts/1 Sl 16:35 0:09 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so child 29
intel 2979620 0.0 0.0 9076 2460 pts/2 S+ 16:36 0:00 grep --color=auto gramine
$ kill $(cat server.PID)
$ ps aux | grep gramine
intel 2979595 19.0 0.5 1074314344 44700 pts/1 Sl 16:35 0:10 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so init gunicorn
intel 2979605 21.0 0.4 1074301800 32164 pts/1 Sl 16:35 0:09 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so child 29
intel 2979623 0.0 0.0 9076 2480 pts/2 S+ 16:36 0:00 grep --color=auto gramine
$ kill 2979595 2979605
$ ps aux | grep gramine
intel 2979595 9.7 0.5 1074314344 44700 pts/1 Sl 16:35 0:10 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so init gunicorn
intel 2979605 9.5 0.4 1074301800 32164 pts/1 Sl 16:35 0:09 /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/loader /home/intel/anjali/gramine/gramine_install/usr/lib/x86_64-linux-gnu/gramine/sgx/libpal.so child 29
intel 2979625 0.0 0.0 9076 2492 pts/2 S+ 16:37 0:00 grep --color=auto gramine
$
@sahason It works now. I will continue to further test on other distros
We tested across distros, and it is working fine, no further issues to report