asker wrote: ↑Fri Jul 24, 2020 8:59 pm
ibrewster wrote: ↑Fri Jul 24, 2020 4:56 pm
One follow-up question: logic seems to indicate that if I limit the area of the image in which to do recognition (by importing my ZM zones and limiting to zones where motion was detected) that should improve speed at least somewhat. Unfortunately, in my testing turning on the import zones features breaks detection completely - I get no detections on events where previously it did detect something within a ZM zone (even without the limiting to motion detected zones on). Any tips for how to troubleshoot this?
See debug logs. See docs on how to make sure debug levels are set correctly, then look at why you get no detections. The
Ok, after some hunting through half a dozen logs, I found that when I tried to run `zm_event_start` with import zm zones on, I was getting a HTTP 500 error:
Code: Select all
07/27/20 13:09:58 zmesdetect_m3[6994] INF zm_detect.py:181 [---------| hook version: 5.15.6, ES version: 5.15 , OpenCV version: 4.4.0|------------]
07/27/20 13:09:58 zmesdetect_m3[6994] ERR utils.py:87 [HTTP Error in import_zm_zones:HTTP Error 500: Internal Server Error]
07/27/20 13:09:58 zmesdetect_m3[6994] ERR utils.py:354 [Error parsing config:/etc/zm/objectconfig.ini]
07/27/20 13:09:58 zmesdetect_m3[6994] ERR utils.py:355 [Error was:HTTP Error 500: Internal Server Error]
07/27/20 13:09:58 zmesdetect_m3[6994] FAT utils.py:356 [error: Traceback:Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/zmes_hook_helpers/utils.py", line 347, in process_config
import_zm_zones(args.get('monitorid'), args.get('reason'))
File "/usr/local/lib/python3.6/site-packages/zmes_hook_helpers/utils.py", line 85, in import_zm_zones
input_file = opener.open(url)
File "/usr/lib64/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib64/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error
So I then went looking for the error log, and found both error.log and cake_error.log, both of which seemed to have the same content. This content appears to indicate that it can't connect to the MySQL server, even though Zoneminder is running (and connecting to the mysql server) just fine:
Code: Select all
2020-07-27 13:13:02 Warning: Warning (2): Use of undefined constant ZM_DB_SSL_CA_CERT - assumed 'ZM_DB_SSL_CA_CERT' (this will throw an Error in a future version of PHP) in [/usr/share/zoneminder/www/api/lib/Cake/Model/ConnectionManager.php, line 69]
Trace:
ErrorHandler::handleError() - CORE/Cake/Error/ErrorHandler.php, line 230
ConnectionManager::_init() - CORE/Cake/Model/ConnectionManager.php, line 69
ConnectionManager::getDataSource() - CORE/Cake/Model/ConnectionManager.php, line 83
Model::setDataSource() - CORE/Cake/Model/Model.php, line 3646
Model::setSource() - CORE/Cake/Model/Model.php, line 1162
Model::getDataSource() - CORE/Cake/Model/Model.php, line 3673
Model::schema() - CORE/Cake/Model/Model.php, line 1394
EnumBehavior::setup() - APP/Plugin/CakePHP-Enum-Behavior/Model/Behavior/EnumBehavior.php, line 34
BehaviorCollection::load() - CORE/Cake/Model/BehaviorCollection.php, line 145
BehaviorCollection::init() - CORE/Cake/Model/BehaviorCollection.php, line 66
Model::__construct() - CORE/Cake/Model/Model.php, line 781
ReflectionClass::newInstance() - [internal], line ??
ClassRegistry::init() - CORE/Cake/Utility/ClassRegistry.php, line 169
Controller::loadModel() - CORE/Cake/Controller/Controller.php, line 741
ZonesController::forMonitor() - APP/Controller/ZonesController.php, line 30
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
AppController::invokeAction() - APP/Plugin/Crud/Lib/CrudControllerTrait.php, line 31
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 107
2020-07-27 13:13:02 Warning: Warning (2): Use of undefined constant ZM_DB_SSL_CLIENT_KEY - assumed 'ZM_DB_SSL_CLIENT_KEY' (this will throw an Error in a future version of PHP) in [/usr/share/zoneminder/www/api/lib/Cake/Model/ConnectionManager.php, line 69]
Trace:
ErrorHandler::handleError() - CORE/Cake/Error/ErrorHandler.php, line 230
ConnectionManager::_init() - CORE/Cake/Model/ConnectionManager.php, line 69
ConnectionManager::getDataSource() - CORE/Cake/Model/ConnectionManager.php, line 83
Model::setDataSource() - CORE/Cake/Model/Model.php, line 3646
Model::setSource() - CORE/Cake/Model/Model.php, line 1162
Model::getDataSource() - CORE/Cake/Model/Model.php, line 3673
Model::schema() - CORE/Cake/Model/Model.php, line 1394
EnumBehavior::setup() - APP/Plugin/CakePHP-Enum-Behavior/Model/Behavior/EnumBehavior.php, line 34
BehaviorCollection::load() - CORE/Cake/Model/BehaviorCollection.php, line 145
BehaviorCollection::init() - CORE/Cake/Model/BehaviorCollection.php, line 66
Model::__construct() - CORE/Cake/Model/Model.php, line 781
ReflectionClass::newInstance() - [internal], line ??
ClassRegistry::init() - CORE/Cake/Utility/ClassRegistry.php, line 169
Controller::loadModel() - CORE/Cake/Controller/Controller.php, line 741
ZonesController::forMonitor() - APP/Controller/ZonesController.php, line 30
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
AppController::invokeAction() - APP/Plugin/Crud/Lib/CrudControllerTrait.php, line 31
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 107
2020-07-27 13:13:02 Warning: Warning (2): Use of undefined constant ZM_DB_SSL_CLIENT_CERT - assumed 'ZM_DB_SSL_CLIENT_CERT' (this will throw an Error in a future version of PHP) in [/usr/share/zoneminder/www/api/lib/Cake/Model/ConnectionManager.php, line 69]
Trace:
ErrorHandler::handleError() - CORE/Cake/Error/ErrorHandler.php, line 230
ConnectionManager::_init() - CORE/Cake/Model/ConnectionManager.php, line 69
ConnectionManager::getDataSource() - CORE/Cake/Model/ConnectionManager.php, line 83
Model::setDataSource() - CORE/Cake/Model/Model.php, line 3646
Model::setSource() - CORE/Cake/Model/Model.php, line 1162
Model::getDataSource() - CORE/Cake/Model/Model.php, line 3673
Model::schema() - CORE/Cake/Model/Model.php, line 1394
EnumBehavior::setup() - APP/Plugin/CakePHP-Enum-Behavior/Model/Behavior/EnumBehavior.php, line 34
BehaviorCollection::load() - CORE/Cake/Model/BehaviorCollection.php, line 145
BehaviorCollection::init() - CORE/Cake/Model/BehaviorCollection.php, line 66
Model::__construct() - CORE/Cake/Model/Model.php, line 781
ReflectionClass::newInstance() - [internal], line ??
ClassRegistry::init() - CORE/Cake/Utility/ClassRegistry.php, line 169
Controller::loadModel() - CORE/Cake/Controller/Controller.php, line 741
ZonesController::forMonitor() - APP/Controller/ZonesController.php, line 30
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
AppController::invokeAction() - APP/Plugin/Crud/Lib/CrudControllerTrait.php, line 31
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 107
2020-07-27 13:13:02 Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
'class' => 'Mysql',
'message' => 'SQLSTATE[HY000] [2006] MySQL server has gone away',
'enabled' => true,
)
Request URL: /zm/api/zones/forMonitor/3.json?username=<my_user>&password=<my_password>&user=<my_user>&pass=<my_password>
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Model/Datasource/DboSource.php(271): Mysql->connect()
#1 /usr/share/zoneminder/www/api/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct(Array)
#2 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3646): ConnectionManager::getDataSource('default')
#3 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(1162): Model->setDataSource('default')
#4 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3673): Model->setSource('Monitors')
#5 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(1394): Model->getDataSource()
#6 /usr/share/zoneminder/www/api/app/Plugin/CakePHP-Enum-Behavior/Model/Behavior/EnumBehavior.php(34): Model->schema()
#7 /usr/share/zoneminder/www/api/lib/Cake/Model/BehaviorCollection.php(145): EnumBehavior->setup(Object(Monitor), Array)
#8 /usr/share/zoneminder/www/api/lib/Cake/Model/BehaviorCollection.php(66): BehaviorCollection->load('CakePHP-Enum-Be...', Array)
#9 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(781): BehaviorCollection->init('Monitor', Array)
#10 [internal function]: Model->__construct(NULL)
#11 /usr/share/zoneminder/www/api/lib/Cake/Utility/ClassRegistry.php(169): ReflectionClass->newInstance(Array)
#12 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(741): ClassRegistry::init('Monitor')
#13 /usr/share/zoneminder/www/api/app/Controller/ZonesController.php(30): Controller->loadModel('Monitor')
#14 [internal function]: ZonesController->forMonitor('3')
#15 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(491): ReflectionMethod->invokeArgs(Object(ZonesController), Array)
#16 /usr/share/zoneminder/www/api/app/Plugin/Crud/Lib/CrudControllerTrait.php(31): Controller->invokeAction(Object(CakeRequest))
#17 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(193): AppController->invokeAction(Object(CakeRequest))
#18 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(ZonesController), Object(CakeRequest))
#19 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#20 {main}
So now I'm a bit lost. Zoneminder can obviously connect, since it uses the database to store events, and that's working fine. But this seems to indicate that the zone minder API *can't* connect to the DB. Is it a different config or something? I guess I'll keep digging, see if I can find anything else to indicate why it can't connect...