google / earthenterprise

Google Earth Enterprise - Open Source
Apache License 2.0
2.67k stars 889 forks source link

Improve `check_server_processes_running` detection for uninstall #453

Open tst-ppenev opened 7 years ago

tst-ppenev commented 7 years ago

The \<earthenterprise/earth_enterprise/src/installer/common.sh> file contains the function check_server_processes_running which is used by uninstall_server.sh to test if Earth Server is running. The check_server_processes_running is rather naive in its implementation, and would report that Earth Server is running and prevent uninstallation, if there's any running process whose command line contains postgres, gehttpd or wsgi:ge_, even if GE Server is not running.

Steps to reproduce:

service geserver stop
vim /opt/google/gehttpd/cgi-bin/geecheck_tests/user_tests/postgres_test.py
./uninstall_server.sh

Expected result:

Uninstall proceeds.

Observed result:

Google Earth Enterprise Server has active running processes.
You must stop all geserver services before running this installer.
Please stop the server using the command ""/etc/init.d/geserver stop"".
tst-ccamp commented 7 years ago

@tst-ppenev Technically, your example should also prevent the uninstaller from running because you are editing a file under the /opt/google/gehttpd/ directory, which would then be deleted by the uninstaller. Honestly, I think it's the safest bet to prevent uninstall from running if there are processes which contain "gehttpd" or "wsgi:ge_". We can't examine every process to see if it would be OK to continue the uninstall. That would require a lot of smarts. But, I think if a process is detected with those strings present, it's likely that it would interfere with the uninstall in some way, but perhaps not certain. We probably need better user feedback and actually display the problematic processes.

On the other hand, I agree that "postgres" is too generic. There's probably a better string we can search for there.

tst-ppenev commented 7 years ago

@tst-ccamp: I don't see why editing a file under /opt/google/gehttpd/ should prevent the uninstaller from running. We're not running on Windows.

All that would be necessary to fix this is to track what services are started and stopped, e.g. use the standard service tracking methods for distributions like Ubuntu and RHEL / Cent OS.