Homegear / Homegear

Interface your smart home devices with your home automation software or your own control scripts.
https://homegear.eu
Other
122 stars 38 forks source link

more clean shutdown order #198

Closed spali closed 9 years ago

spali commented 9 years ago

It's maybe just cosmetics, so don't rate it with high priority. When Homegear shuts down, either events get's still executed after the rpc server stopped accepting connections or still running event tries to connect. please make sure:

Here an example of my log.

04/26/15 12:39:36.737 (Shutdown) => Stopping Homegear (Signal: 15)
04/26/15 12:39:37.200 Scriptengine (/var/lib/homegear/scripts/Homegear/VirtualDeviceProgrammHandler.php): PHP Fatal error:  Uncaught exception 'ErrorException' with message 'stream_socket_client(): unable to connect to tcp://localhost:2001 (Connection reset by peer)' in /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php:134
Stack trace:
#0 [internal function]: Homegear\{closure}(2, 'stream_socket_c...', '/var/lib/homege...', 134, Array)
#1 /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php(134): stream_socket_client('tcp://localhost...', 104, 'Connection rese...', 10)
#2 /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php(165): XMLRPC\Client->connect()
#3 /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php(228): XMLRPC\Client->sendRequest('<?xml version="...')
#4 /var/lib/homegear/scripts/Homegear/autoload/HomegearProxy.php(54): XMLRPC\Client->send('logLevel', Array)
#5 /var/lib/homegear/scripts/Homegear/autoload/HomegearProxy.php(40): Homegear\Proxy->rpcCall('logLevel')
#6 /var/lib/homegear/scripts/Homegear/autoload/Homegear.php(72): Homegear\Proxy->__call('logLevel', Array)
#7 /var/lib/homegear/scripts/Homegear/autoloa in /var/lib/homegear/scripts/HM-XMLRPC-Client/Client.php on line 134
hfedcba commented 9 years ago

Stopping event processing before stopping the RPC server makes absolutely sense. Changing this was easy ;-). I'm waiting until all events finished processing before stopping the RPC servers.