recognize
recognize copied to clipboard
Failed to classify images - Array buffer allocation failed
When trying to run the classify process manually, it fails:
root@raspberrypi:/var/www/nextcloud# sudo -u www-data php occ recognize:classify -vvv
Classifying photos of user NextcloudAdmin
Failed to classify images
Classifier process error
I would like to have it run automatically and manually. How do I achieve this?
In the logs I find two log entries which seem to be related: a warning from recognize:
[recognize] Warning: Classifier process output: RangeError: Array buffer allocation failed
at new ArrayBuffer (<anonymous>)
at Object.toArrayBuffer (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/io_utils.js:41:18)
at NodeFileSystem.<anonymous> (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:268:76)
at step (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:48:23)
at Object.next (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:29:53)
at fulfilled (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:20:58)
at 2021-09-16T14:16:03+02:00
and an error from php. Sorry that it is not formatted, I could not find a formatted version.
{"reqId":"T76flJzxdo72sKZGbL2x","level":3,"time":"2021-09-16T14:16:03+02:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"fwrite(): write of 8192 bytes failed with errno=32 Broken pipe at /var/www/nextcloud/3rdparty/symfony/process/Pipes/AbstractPipes.php#128","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Pipes/AbstractPipes.php","line":128,"function":"fwrite"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Pipes/UnixPipes.php","line":95,"function":"write","class":"Symfony\\Component\\Process\\Pipes\\AbstractPipes","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":1436,"function":"readAndWrite","class":"Symfony\\Component\\Process\\Pipes\\UnixPipes","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":1359,"function":"readPipes","class":"Symfony\\Component\\Process\\Process","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":1407,"function":"updateStatus","class":"Symfony\\Component\\Process\\Process","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":655,"function":"readPipesForOutput","class":"Symfony\\Component\\Process\\Process","type":"->"},{"file":"/var/www/nextcloud/apps/recognize/lib/Service/ClassifyImagenetService.php","line":82,"function":"getIterator","class":"Symfony\\Component\\Process\\Process","type":"->"},{"file":"/var/www/nextcloud/apps/recognize/lib/Command/Classify.php","line":99,"function":"classify","class":"OCA\\Recognize\\Service\\ClassifyImagenetService","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OCA\\Recognize\\Command\\Classify","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1000,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":271,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":147,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":215,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"--","version":"20.0.10.1","id":"614335b7e054c"}
I am running Nextcloud 20.0.10 on a raspberry pi 4 with 4 GB RAM. More than 3 GB RAM are available
Operating System: | Linux 5.10.17-v7l+ armv7l CPU: | ARMv7 Processor rev 3 (v7l) (4 cores) Memory: | 3.74 GB
I get an error like 'classifier timed out' But only appears when the process begins running and then gets terminated @marcelklehr please make the timeout higher. My computer isn't high-end and just may need a bit longer. Classifier works but most times a timed out returns. I don't know if this also affects automatic launches
When trying to run the classify process manually, it fails:
root@raspberrypi:/var/www/nextcloud# sudo -u www-data php occ recognize:classify -vvv Classifying photos of user NextcloudAdmin Failed to classify images Classifier process error
I would like to have it run automatically and manually. How do I achieve this?
In the logs I find two log entries which seem to be related: a warning from recognize:
[recognize] Warning: Classifier process output: RangeError: Array buffer allocation failed at new ArrayBuffer (<anonymous>) at Object.toArrayBuffer (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/io_utils.js:41:18) at NodeFileSystem.<anonymous> (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:268:76) at step (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:48:23) at Object.next (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:29:53) at fulfilled (/var/www/nextcloud/apps/recognize/node_modules/@tensorflow/tfjs-node/dist/io/file_system.js:20:58) at 2021-09-16T14:16:03+02:00
and an error from php. Sorry that it is not formatted, I could not find a formatted version.
{"reqId":"T76flJzxdo72sKZGbL2x","level":3,"time":"2021-09-16T14:16:03+02:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":{"Exception":"Error","Message":"fwrite(): write of 8192 bytes failed with errno=32 Broken pipe at /var/www/nextcloud/3rdparty/symfony/process/Pipes/AbstractPipes.php#128","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Pipes/AbstractPipes.php","line":128,"function":"fwrite"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Pipes/UnixPipes.php","line":95,"function":"write","class":"Symfony\\Component\\Process\\Pipes\\AbstractPipes","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":1436,"function":"readAndWrite","class":"Symfony\\Component\\Process\\Pipes\\UnixPipes","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":1359,"function":"readPipes","class":"Symfony\\Component\\Process\\Process","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":1407,"function":"updateStatus","class":"Symfony\\Component\\Process\\Process","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/3rdparty/symfony/process/Process.php","line":655,"function":"readPipesForOutput","class":"Symfony\\Component\\Process\\Process","type":"->"},{"file":"/var/www/nextcloud/apps/recognize/lib/Service/ClassifyImagenetService.php","line":82,"function":"getIterator","class":"Symfony\\Component\\Process\\Process","type":"->"},{"file":"/var/www/nextcloud/apps/recognize/lib/Command/Classify.php","line":99,"function":"classify","class":"OCA\\Recognize\\Service\\ClassifyImagenetService","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php","line":255,"function":"execute","class":"OCA\\Recognize\\Command\\Classify","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":1000,"function":"run","class":"Symfony\\Component\\Console\\Command\\Command","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":271,"function":"doRunCommand","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/console/Application.php","line":147,"function":"doRun","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/Console/Application.php","line":215,"function":"run","class":"Symfony\\Component\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/console.php","line":100,"function":"run","class":"OC\\Console\\Application","type":"->"},{"file":"/var/www/nextcloud/occ","line":11,"args":["/var/www/nextcloud/console.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"--","version":"20.0.10.1","id":"614335b7e054c"}
I am running Nextcloud 20.0.10 on a raspberry pi 4 with 4 GB RAM. More than 3 GB RAM are available
Operating System: | Linux 5.10.17-v7l+ armv7l CPU: | ARMv7 Processor rev 3 (v7l) (4 cores) Memory: | 3.74 GB
I think that the raspberry pi kernel doesn't even support fsync - and fsync command fails so you have to try with a patch or another kernel that works with the pi
Edits It more looks like a process is terminated (pipe broken) And this might be because of low specs...
Do you have a swap (please do not set up a swap on a SD card it will die
It does seem like your RAM is exhausted when running the classifier. Can you confirm that by monitoring running processes in e.g. htop?
When starting htop with -d 1 I can see RAM Usage increases to 1.5-1.6 GB before the process dies.
After I increased the swap it took a lot longer for the process to die but it still did with the same error. It also never reached more than 50% RAM Usage.
Is there a way I can get more verbose debug information?
Do you have earlyoom or something like that? Earlyoom is a fix of the oom-killer
But still, the percent when it kills a process is too high. It might cause troubles
Also maybe something's not good with the ram? I heard that a RAM of a PI4 can be locked so you can't allocate all. Simply unlock by an SD card with an image from the raspberry pi flasher that will change this setting
It looks like something's not good with fsync. An fwrite command fails with only 8MB writing. Do you have free space on the raspberry pi? Or isn't it supported?
I am not a specialist but ... You could Google for it. Fsync Raspberry pi broken pipe etc.
The borken pipe is likely because the subprocess dies while the php process still wants to write to it.
Maybe an issue with the kernel, couldn't it be?
Do you have earlyoom or something like that? Earlyoom is a fix of the oom-killer
But still, the percent when it kills a process is too high. It might cause troubles
Also maybe something's not good with the ram? I heard that a RAM of a PI4 can be locked so you can't allocate all. Simply unlock by an SD card with an image from the raspberry pi flasher that will change this setting
I haven't installed earlyoom or anything like that. Tbh I did not even know oom existed. Currently running memtester and I seem to be able to use all of the memory just fine. So that should not be it.
Maybe an issue with the kernel, couldn't it be?
I will try to update and report back
An update might not help much but try it... Almost always good to do that
Maybe there's another kernel for Raspberry Pi's Why not try then
The update did not help sadly. The Kernel was also updated. journalctl does not show any kernel errors, so I doubt the kernel is at fault..
Is it possible to have this plugin run on a different system than the nextcloud instance? While using the files on the nextcloud instance?
It may be the architecture. ARM64 does not seem to be supported by libtensorflow.
It may be the architecture. ARM64 does not seem to be supported by libtensorflow.
I exchanged libtensorflow against a version explicitely compiled for the raspberry as described here: https://qengineering.eu/install-tensorflow-2.1.0-on-raspberry-pi-4.html However I sadly still have the same problem.
I think at this point I can't help anymore. I'm not contributing code - I didn't look into the code
Are there any Raspberry Pi Simulators here? I don't have version 4 around
Maybe you changed a knob (kernel behaviour setting)?
Could it be related to the php memory limit? I'm having a similar issue in a rasspi 4, and the top process before the crash was a php one.
I have it limited to 512MB wich ist recommended by Nextcloud
Could you try to run the script manually without Nextcloud?
The update did not help sadly. The Kernel was also updated. journalctl does not show any kernel errors, so I doubt the kernel is at fault..
Is it possible to have this plugin run on a different system than the nextcloud instance? While using the files on the nextcloud instance?
Well, I made a request (see Issue somewhere there opened) wich means that it could take some time for that but currently it's not out
Same issue for me on Raspbian.
Operating System: Linux 5.10.63-v7l+ armv7l
CPU: ARMv7 Processor rev 3 (v7l)
(4 cores)
Memory: 3.74 GB
Does it work in pure JS mode at least or does that also not work?
For me, JavaScript mode doesn't work either (I am also running Nextxloud 22 on a raspberry pi 4 with yunohost)
JS mode does not work for me either.
Could it be related to the php memory limit? I'm having a similar issue in a rasspi 4, and the top process before the crash was a php one.
No, it's not related to it because it runs using node not php But the thing that searches for new filed is using php
Closing due to being outdated. v2 is no longer maintained. Please try again with Recognize v3 and Nextcloud 25 :pray: