nextcloud / recognize

👁 👂 Smart media tagging for Nextcloud: recognizes faces, objects, landscapes, music genres
https://apps.nextcloud.com/apps/recognize
GNU Affero General Public License v3.0
555 stars 46 forks source link

Assigning unknown face causes high CPU usage #1104

Open jmigual opened 8 months ago

jmigual commented 8 months ago

Which version of recognize are you using?

5.0.3

Enabled Modes

Object recognition, Face recognition, Video recognition, Music recognition

TensorFlow mode

Normal mode

Downstream App

Memories App

Which Nextcloud version do you have installed?

27.1.6

Which Operating system do you have installed?

Docker running in Debian 12

Which database are you running Nextcloud on?

Postgresql 16

Which Docker container are you using to run Nextcloud? (if applicable)

nextcloud:27-fpm

How much RAM does your server have?

4GiB

What processor Architecture does your CPU have?

x86_64

Describe the Bug

When I go to the unassigned faces (e.g. with id NULL) and I try to assign a face to a person (either existing or not). The CPU spikes to 100% for a long time and memory usage goes up a lot. This gets worse the more faces I add. Usually with 6-10 faces it takes almost 7 minutes to get back to normal and sometimes linux's OOM killer kicks in.

Expected Behavior

A face is assigned without much resource consumption.

To Reproduce

  1. Scan some images and have unrecognized faces
  2. Go to unknown faces
  3. Assign one of the images to a face.
  4. Either check task manager or wait a bit as the system becomes unresponsive.

Debug log

No response

github-actions[bot] commented 8 months ago

Hello :wave:

Thank you for taking the time to open this issue with recognize. I know it's frustrating when software causes problems. You have made the right choice to come here and open an issue to make sure your problem gets looked at and if possible solved. I try to answer all issues and if possible fix all bugs here, but it sometimes takes a while until I get to it. Until then, please be patient. Note also that GitHub is a place where people meet to make software better together. Nobody here is under any obligation to help you, solve your problems or deliver on any expectations or demands you may have, but if enough people come together we can collaborate to make this software better. For everyone. Thus, if you can, you could also look at other issues to see whether you can help other people with your knowledge and experience. If you have coding experience it would also be awesome if you could step up to dive into the code and try to fix the odd bug yourself. Everyone will be thankful for extra helping hands! One last word: If you feel, at any point, like you need to vent, this is not the place for it; you can go to the forum, to twitter or somewhere else. But this is a technical issue tracker, so please make sure to focus on the tech and keep your opinions to yourself. (Also see our Code of Conduct. Really.)

I look forward to working with you on this issue Cheers :blue_heart:

jmigual commented 8 months ago

Also my system is a 6-core virtual machine

Snider commented 8 months ago

Here is a debug log;

TypeError
OCA\Recognize\Dav\Faces\UnassignedFacePhoto::__construct(): Argument #5 ($preview) must be of type OCP\IPreview, null given, called in /home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php on line 108
{"reqId":"v2H8NuVQIWeGXsPUbYRK","level":3,"time":"2024-02-18T22:38:02+00:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"snider","app":"webdav","method":"PROPFIND","url":"/remote.php/dav/recognize/snider/unassigned-faces","message":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacePhoto::__construct(): Argument #5 ($preview) must be of type OCP\\IPreview, null given, called in /home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php on line 108","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36","version":"28.0.2.5","exception":{"Exception":"TypeError","Message":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacePhoto::__construct(): Argument #5 ($preview) must be of type OCP\\IPreview, null given, called in /home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php on line 108","Code":0,"Trace":[{"file":"/home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php","line":108,"function":"__construct","class":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacePhoto","type":"->"},{"function":"OCA\\Recognize\\Dav\\Faces\\{closure}","class":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacesHome","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php","line":107,"function":"array_map"},{"file":"/home/server/public_html/apps/recognize/lib/Dav/Faces/PropFindPlugin.php","line":71,"function":"getChildren","class":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacesHome","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/PropFind.php","line":95,"function":"OCA\\Recognize\\Dav\\Faces\\{closure}","class":"OCA\\Recognize\\Dav\\Faces\\PropFindPlugin","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/server/public_html/apps/recognize/lib/Dav/Faces/PropFindPlugin.php","line":71,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"propFind","class":"OCA\\Recognize\\Dav\\Faces\\PropFindPlugin","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1052,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":984,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1662,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1647,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/apps/dav/lib/Server.php","line":370,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/home/server/public_html/remote.php","line":172,"args":["/home/server/public_html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacePhoto.php","Line":18,"message":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacePhoto::__construct(): Argument #5 ($preview) must be of type OCP\\IPreview, null given, called in /home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php on line 108","exception":[],"CustomMessage":"OCA\\Recognize\\Dav\\Faces\\UnassignedFacePhoto::__construct(): Argument #5 ($preview) must be of type OCP\\IPreview, null given, called in /home/server/public_html/apps/recognize/lib/Dav/Faces/UnassignedFacesHome.php on line 108"},"id":"65d2931cb6b3f"}