Imaginary not working on Nextcloud AIO

Nextcloud version (eg, 20.0.5): 24.0.5 - 24.0.5.1
Operating system and version (eg, Ubuntu 20.04): Nextcloud AIO -- Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.54
PHP version (eg, 7.4): 8.0.23

The issue you are facing:
I just enabled Imaginary for Nextcloud AIO and everything started fine. Whenever I browse photos however some don’t load and I get a bunch of errors in the logs. It makes the server unusable and pegs all of the cores to 100% until it errors out about a minute later.

Is this the first time you’ve seen this error? (Y/N): Yes

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 30000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://nextcloud-aio-imaginary:9000/pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D at <<closure>>

 0. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php line 158
    GuzzleHttp\Handler\CurlFactory::createRejection(GuzzleHttp\Handl ... l}, [28,"Operation t ... "])
 1. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php line 110
    GuzzleHttp\Handler\CurlFactory::finishError(GuzzleHttp\Handler\CurlHandler {}, GuzzleHttp\Handl ... l}, GuzzleHttp\Handler\CurlFactory {})
 2. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandler.php line 47
    GuzzleHttp\Handler\CurlFactory::finish(GuzzleHttp\Handler\CurlHandler {}, GuzzleHttp\Handl ... l}, GuzzleHttp\Handler\CurlFactory {})
 3. /var/www/html/lib/private/Http/Client/DnsPinMiddleware.php line 113
    GuzzleHttp\Handler\CurlHandler->__invoke("*** sensitive parameters replaced ***", "*** sensitive parameters replaced ***")
 4. /var/www/html/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php line 64
    OC\Http\Client\DnsPinMiddleware->OC\Http\Client\{closure}("*** sensitive parameters replaced ***")
 5. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 31
    GuzzleHttp\PrepareBodyMiddleware->__invoke("*** sensitive parameters replaced ***", "*** sensitive parameters replaced ***")
 6. /var/www/html/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php line 71
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 7. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 63
    GuzzleHttp\RedirectMiddleware->__invoke("*** sensitive parameters replaced ***", "*** sensitive parameters replaced ***")
 8. /var/www/html/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php line 75
    GuzzleHttp\Middleware::GuzzleHttp\{closure}("*** sensitive parameters replaced ***")
 9. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php line 331
    GuzzleHttp\HandlerStack->__invoke("*** sensitive parameters replaced ***", "*** sensitive parameters replaced ***")
10. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php line 168
    GuzzleHttp\Client->transfer("*** sensitive parameters replaced ***", "*** sensitive parameters replaced ***")
11. /var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php line 187
    GuzzleHttp\Client->requestAsync("post", GuzzleHttp\Psr7\Uri {}, ["/mnt/ncdata/fi ... "])
12. /var/www/html/lib/private/Http/Client/Client.php line 289
    GuzzleHttp\Client->request("post", "http://nextclou ... e", ["/mnt/ncdata/fi ... "])
13. /var/www/html/lib/private/Preview/Imaginary.php line 111
    OC\Http\Client\Client->post("http://nextclou ... e", [["[{\"operation ... ]])
14. /var/www/html/lib/private/Preview/GeneratorHelper.php line 63
    OC\Preview\Imaginary->getCroppedThumbnail(OC\Files\Node\File {}, 256, 256, false)
15. /var/www/html/lib/private/Preview/Generator.php line 266
    OC\Preview\GeneratorHelper->getThumbnail(OC\Preview\Imaginary {}, OC\Files\Node\File {}, 256, 256, false)
16. /var/www/html/lib/private/Preview/Generator.php line 148
    OC\Preview\Generator->getSmallImagePreview(OC\Files\SimpleFS\SimpleFolder {}, OC\Files\Node\File {}, "image/heic", "", false)
17. /var/www/html/lib/private/Preview/Generator.php line 111
    OC\Preview\Generator->generatePreviews(OC\Files\Node\File {}, [[250,250,false,"fill"]], "image/heic")
18. /var/www/html/lib/private/PreviewManager.php line 212
    OC\Preview\Generator->getPreview(OC\Files\Node\File {}, 250, 250, false, "fill", null)
19. /var/www/html/core/Controller/PreviewController.php line 169
    OC\PreviewManager->getPreview(OC\Files\Node\File {}, 250, 250, false, "fill")
20. /var/www/html/core/Controller/PreviewController.php line 142
    OC\Core\Controller\PreviewController->fetchPreview(OC\Files\Node\File {}, 250, 250, true, false, "fill")
21. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 225
    OC\Core\Controller\PreviewController->getPreviewByFileId(13593, 250, 250, true, false, "fill")
22. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Controller\PreviewController {}, "getPreviewByFileId")
23. /var/www/html/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Controller\PreviewController {}, "getPreviewByFileId")
24. /var/www/html/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main("OC\\Core\\Controller\\PreviewController", "getPreviewByFileId", OC\AppFramework\ ... {}, ["core.Preview.getPreviewByFileId"])
25. /var/www/html/lib/base.php line 1030
    OC\Route\Router->match("/core/preview")
26. /var/www/html/index.php line 36
    OC::handleRequest()

GET /core/preview?fileId=13593&c=1077c4bf1029d19a2d9fa1af560d7de2&x=250&y=250&forceIcon=0&a=1
from 192.168.50.1 by jahanson at 2022-10-04T15:27:44+00:00

Imaginary Logs:
The logs are basically spammed with ‘set_mempolicy: Operation not permitted


set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
set_mempolicy: Operation not permitted
127.0.0.1 - - [04/Oct/2022 15:27:31] "HEAD / HTTP/1.1" 405 123 0.0000
172.21.0.9 - - [04/Oct/2022 15:28:01] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 73.5910
127.0.0.1 - - [04/Oct/2022 15:28:02] "HEAD / HTTP/1.1" 405 123 0.0000
172.21.0.9 - - [04/Oct/2022 15:28:03] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 78.8296
172.21.0.9 - - [04/Oct/2022 15:28:12] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 87.4153
172.21.0.9 - - [04/Oct/2022 15:28:12] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 88.5529
172.21.0.9 - - [04/Oct/2022 15:28:13] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 88.4212
172.21.0.9 - - [04/Oct/2022 15:28:13] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 88.7776
172.21.0.9 - - [04/Oct/2022 15:28:13] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 89.2589
172.21.0.9 - - [04/Oct/2022 15:28:13] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 88.9756
172.21.0.9 - - [04/Oct/2022 15:28:14] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 89.9772
172.21.0.9 - - [04/Oct/2022 15:28:16] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 91.8197
172.21.0.9 - - [04/Oct/2022 15:28:16] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 91.8074
172.21.0.9 - - [04/Oct/2022 15:28:16] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 92.1193
172.21.0.9 - - [04/Oct/2022 15:28:16] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 92.5782
172.21.0.9 - - [04/Oct/2022 15:28:17] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3956 92.5813
172.21.0.9 - - [04/Oct/2022 15:28:17] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 93.4677
172.21.0.9 - - [04/Oct/2022 15:28:18] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 93.3479
172.21.0.9 - - [04/Oct/2022 15:28:18] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 89.1449
172.21.0.9 - - [04/Oct/2022 15:28:19] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 88.5615
172.21.0.9 - - [04/Oct/2022 15:28:19] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 88.8770
172.21.0.9 - - [04/Oct/2022 15:28:20] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 85.9103
172.21.0.9 - - [04/Oct/2022 15:28:20] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 76.9110
172.21.0.9 - - [04/Oct/2022 15:28:23] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 76.7122
172.21.0.9 - - [04/Oct/2022 15:28:25] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 71.4804
172.21.0.9 - - [04/Oct/2022 15:28:25] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3956 71.4215
172.21.0.9 - - [04/Oct/2022 15:28:26] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 71.2866
172.21.0.9 - - [04/Oct/2022 15:28:26] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 71.4579
172.21.0.9 - - [04/Oct/2022 15:28:26] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22autorotate%22%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A256%2C%22height%22%3A256%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22jpeg%22%2C%22norotation%22%3A%22true%22%7D%7D%5D HTTP/1.1" 200 3955 71.4980

UPDATE
I’ve tried converting some of the files inside of the nextcloud docker container that weren’t loading and they’re converting correctly. So I’m at a loss here.

Example command:
curl -L -o img.jpg -X POST "http://nextcloud-aio-imaginary:9000/crop?width=500&height=400" --data-binary "@/mnt/nextcloud_data/jahanson/files/Photos/Recents/IMG_3122.HEIC"