Commit 6984262e authored by Patrick J Cherry's avatar Patrick J Cherry
Browse files

Merge branch '12783-memory-pressure' into 'jessie'

Exit if no domains have been detected


It seems that during periods of memory pressure, sometimes `getpwuid` fails and `symbiosis/domains.rb` just dies mid-script. Nothing is returned to `symbiosis-httpd-configure`, so the `configurations` array remains empty indicating that there aren't any domains configured. All sites in `sites-enabled` subsequently get deleted.

The only situation in which the `configurations` array should be empty is when `/srv` has no directories, but in that case there's no real reason to run `symbiosis-httpd-configure`. As I understand it, every customer using Symbiosis+Apache should have at least one directory in `/srv`, so it's probably better to just exit if `configurations` is empty rather than continue to delete all sites.

See merge request !4
parents 312826eb 1316dea5
......@@ -240,6 +240,16 @@ Symbiosis::Domains.each(prefix) do |domain|
configurations << this_config
# Sometimes, significant memory pressure can cause Etc.getpwuid(@uid).name
# to fail. symbiosis-httpd-configure is then led to believe there aren't any
# domains and will delete all sites from sites-enabled. Exit instead.
if configurations.empty?
verbose "\tNo domains detected. This could be due to memory pressure. Exiting."
exit 1
# Now see to the mass hosting stuff.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment