Closed intervisionlord closed 2 years ago
This seems to be an incompatibility with the access control app. Can you check if there are any rules set up in the access control app (you can send them privately to my mail address if you do not want to disclose them)?
I suspect the creation of recipes without an image is working, right? Does adding an image to an existing recipe work?
I tried to narrow this down. When installing the files access control app, I was not able to reproduce it. Please share any relevant access control settings.
Apart from that, did I get the steps correctly? You created a new recipe and added an image to it, right?
Hi,
You created a new recipe and added an image to it, right?
Correct.
I suspect the creation of recipes without an image is working, right?
Yes, without images everything goes good. New folder creates correctly for new recipe and .json presents there as well.
Does adding an image to an existing recipe work?
It works but there are some strange things. The app still shows errors (and in NC log this errors also persists), but after several tries main picture appears in recipe folder and on recipe page.
Can you check if there are any rules set up in the access control app
Yes, I have 2 rules configured in Acess Control app. First one on admin level - Remove files marked by certain tag after several days defined in this tag. Second one on user level - Mark files contains some expression (like _rem1d) in the end of name by certain tag (to autoremove file after some days) That's all.
Also i tried to disable access control app and when i tried to create new recipe i had another error:
Return value of OCA\Cookbook\Service\ThumbnailService::createThumbnail() must be of the type string, null returned in file '***sensitive data***/apps/cookbook/lib/Service/ThumbnailService.php' line 83
POST /apps/cookbook/api/recipes
And some other errors:
core OC_Image->centerCrop, No image loaded
core OC_Image::resize(): No image loaded
core OC_Image::fixOrientation(): No image loaded
Could you temporarily enable 'debug'
in the nextcloud config (see here) while adding a recipe?
According to your message, I suspect that you have updated to 0.9.12 in the meantime, right?
How many recipes do you have currently in your instance approx? (Read: Can you manually check all recipes if the full.jpg
is a valid image or are there simply too many recipes?) If you can check manually:
full.jpg
and are these files valid JPG files? Especially do they have a size larger than 0?thumb.jpg
and thumb16.jpg
files present?Could you temporarily enable 'debug' in the nextcloud config while adding a recipe?
Sure, done.
I suspect that you have updated to 0.9.12 in the meantime, right?
Yes, now i have 0.9.12 version.
How many recipes do you have currently in your instance approx?
Currently i have no any recipes (i installed this app first time for tests before usage). I have created new test recipe and after getting error checked images:
Did the enabled debug mode output more detailed logs?
Can you open the PHP interpreter on the server as the user you are running the NC instance?
Did the enabled debug mode output more detailed logs?
No, unfortunately there are no new detailed data in logs associated with this app
Can you open the PHP interpreter on the server as the user you are running the NC instance?
Yes, this is my own bare metal server, i can do everything on it (unless it does not ruin production level)
OK, sorry for the delay. Can you test the following script and post what the output is (roughly copied from here):
<?php
$tmpFile = tmpfile();
if($tmpFile === false) {
echo "No tmp file was generated\n";
exit(1);
}
$ret = fwrite($tmpFile, "Some data");
if($ret === false) {
echo "Could not write\n";
exit(1);
}
if(! fflush($tmpFile)){
echo "Could not flush\n";
exit(1);
}
$info = stream_get_meta_data($tmpFile);
print_r($info);
echo "The filename is " . $info['uri'] . "\n";
If you want you can create a temporary file in the NC in /apps/cookbook/tmp.php and put things there or any (no yet existing file in the NC folder tree). Just remove the file after the test.
If the script terminates successfully, please check if the folder mentioned in the last row is capable of storing a few MB.
If this is not bringing us closer to the problem, I fear, we have to prepare more verbose logging and install that on your machine. This will however take a few minutes to be prepared.
well, i have something like this:
> php -f tmp.php
Array
(
[timed_out] =>
[blocked] => 1
[eof] =>
[wrapper_type] => plainfile
[stream_type] => STDIO
[mode] => r+b
[unread_bytes] => 0
[seekable] => 1
[uri] => /tmp/phpwAC5qm
)
The filename is /tmp/phpwAC5qm
> php -v
PHP 8.0.16 (cli) (built: Jun 29 2020 09:25:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.16, Copyright (c) Zend Technologies
with Zend OPcache v8.0.16, Copyright (c), by Zend Technologies
> df -h /tmp
Filesystem Size Used Available Usage% Mounted
/dev/sda1 225G 56G 158G 27% /
OK, that means, the temp file was generated successfully. As I cannot confirm on my dev environment, I will have to make a dev version with much more logging to get a more detailed view of the steps in your instance. This will take a few minutes to be finished, sorry.
Ok, don't worry about it. This issue not urgent or critical for me, i just created it to inform you, that something goes unexpected in this app.
Hello @intervisionlord. I started a new branch from the current 0.9.13 version of the app. You can find the checks by filtering the action list. Recently, I wrote a step-by-step instruction.
Please first update to the latest cookbook app 0.9.13. Then you can overwrite the files with the ones in the newest succeeded test. If we need to investigate further, I can put more debugging code into the code base and you can just download the newest test results again :smile:.
I added some debug messages to the logs with log level debug
. You can redact them if you see fit. There might be some confidential data like the absolute path of your NC installation present. Please post all generated logs here so we can see what was happening.
Hello @intervisionlord. I started a new branch from the current 0.9.13 version of the app. You can find the checks by filtering the action list. Recently, I wrote a step-by-step instruction.
Please first update to the latest cookbook app 0.9.13. Then you can overwrite the files with the ones in the newest succeeded test. If we need to investigate further, I can put more debugging code into the code base and you can just download the newest test results again π.
I added some debug messages to the logs with log level
debug
. You can redact them if you see fit. There might be some confidential data like the absolute path of your NC installation present. Please post all generated logs here so we can see what was happening.
Hello, seems it was not help. I have captured a short video shown the problem if it help. https://twrc.ru/s/NEXip6YP5AwAiqp
Also i can create a separate account for you to test it. And here is an error from debug log:
[index] ΠΡΠΈΠ±ΠΊΠ°: Exception: OCA\Cookbook\Service\ThumbnailService::createThumbnail(): Return value must be of type string, null returned in file '<nc dir>/apps/cookbook/lib/Service/ThumbnailService.php' line 94 at <<closure>>
0. <nc dir>/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Cookbook\Con ... {}, "create")
1. <nc dir>/lib/private/Route/Router.php line 298
OC\AppFramework\App::main("OCA\\Cookbook\\ ... r", "create", OC\AppFramework\ ... {}, ["cookbook.recipe.create"])
2. <nc dir>/lib/base.php line 1023
OC\Route\Router->match("/apps/cookbook/api/recipes")
3. <nc dir>/index.php line 36
OC::handleRequest()
POST /apps/cookbook/api/recipes
from 213.141.140.52 by testuser at 2022-07-14T11:28:27+00:00
Reason: TypeError: OCA\Cookbook\Service\ThumbnailService::createThumbnail(): Return value must be of type string, null returned
<nc dir>/apps/cookbook/lib/Service/ThumbnailService.php - line 54:
OCA\Cookbook\Service\ThumbnailService->createThumbnail(null, 256)
<nc dir>/apps/cookbook/lib/Helper/ImageService/ImageGenerationHelper.php - line 64:
OCA\Cookbook\Service\ThumbnailService->getThumbnail(null, 2)
<nc dir>/apps/cookbook/lib/Helper/ImageService/ThumbnailFileHelper.php - line 96:
OCA\Cookbook\Helper\ImageService\ImageGenerationHelper->generateThumbnail(OC\Files\Node\File {}, 2, OC\Files\Node\File {})
<nc dir>/apps/cookbook/lib/Helper/ImageService/ThumbnailFileHelper.php - line 117:
OCA\Cookbook\Helper\ImageService\ThumbnailFileHelper->recreateSingleThumbnail(OC\Files\Node\Folder {}, 2)
<nc dir>/apps/cookbook/lib/Service/ImageService.php - line 137:
OCA\Cookbook\Helper\ImageService\ThumbnailFileHelper->recreateThumbnails(OC\Files\Node\Folder {})
<nc dir>/apps/cookbook/lib/Service/RecipeService.php - line 812:
OCA\Cookbook\Service\ImageService->setImageData(OC\Files\Node\Folder {}, null)
<nc dir>/apps/cookbook/lib/Controller/RecipeController.php - line 157:
OCA\Cookbook\Service\RecipeService->addRecipe([ 0,"test"," ... "])
<nc dir>/lib/private/AppFramework/Http/Dispatcher.php - line 225:
OCA\Cookbook\Controller\RecipeController->create()
<nc dir>/lib/private/AppFramework/Http/Dispatcher.php - line 133:
OC\AppFramework\Http\Dispatcher->executeController(OCA\Cookbook ... {}, "create")
<nc dir>/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Cookbook ... {}, "create")
<nc dir>/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main("OCA\\Cookbo ... r", "create", OC\AppFramew ... {}, [ "cookbook.recipe.create"])
<nc dir>/lib/base.php - line 1023:
OC\Route\Router->match("/apps/cookbook/api/recipes")
<nc dir>/index.php - line 36:
OC::handleRequest()
Hello @intervisionlord.
Regarding the rest account, it does not help much at the moment as we are facing issues in the server. I would need debugging access and this is out of scope here for security reasons.
Was there nothing logged in the nextcloud logs just before the exception was thrown? There should be some debug messages written during processing. If your log file is too large, I can provide a shell script for filtering and pretty printing.
The branch i gave you was no intended fix but an investigation by adding some logging command at critical locations to see where the problem is located. Once, we get the reason, we can start fixing it.
At least, the last comment contained a stack trace. That might already help a bit.
Hello @christianlupus
well, i tried to collect log via terminal from logfile directly instead of waitig NC to show me this log in UI and i have this:
After this i disable workflow extension (just in case) and other extensions which can affect files but it hasn't changed the behavior of cookbook plugin.
And this huge log (in attach) according to cookbook plugin: nc.log
Hello @intervisionlord.
Regarding the rest account, it does not help much at the moment as we are facing issues in the server. I would need debugging access and this is out of scope here ATM for security reasons.
The branch i gave you was no intended fix but an investigation by adding some logging command at critical locations to see where the problem is located. Once, we get the reason, we can start fixing it.
The added extensive logs gave a few hints. I added some more debug messages to the code. Could you please retry and post the messages again?
My investigation points towards a problem with the core. Can you please verify that the version of the nextcloud vote is still up to date in your first post?
Hello @christianlupus
Should i download files again from your branch? (I am interesting because i haven't found last changes in it. Or maybe i missed smth.?)
Since May 11 i already have NC version 24.0.2 Several hours ago a new version (24.0.3) was anounced. I need some free time on this week to update my NC server (i'll try to do it ASAP) and i'll get new debug log.
Thank you for your patience.
I pushed some changes like 13h ago. The corresponding action is found here.
No worries about the delay. Take your time. Just keep the information updated as this seems to be an issue in cooperation with the core and thus we need to keep the core source code in the picture.
@christianlupus Hello again, sorry for the long time without any information about this case. Finally i have a free time to test it again.
So, i have downloaded again app files from the branch that you have provided earlier. Also i have updated my NC installation to version 24.0.3.
And now something strange occurs with my logs. Now i have not any information associated with cookbook plugin.
When i tried to find something about app in nextcloud.log
i have found only messages below:
> grep -i cookbook nextcloud.log
{"reqId":"21plAKFFC6ghsRMBomps","level":0,"time":"August 08, 2022 17:34:15","remoteAddr":**SENSITIVE DATA REMOVED**,"user":**SENSITIVE DATA REMOVED**,"app":"cms_pico","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fcookbook%2F","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"cms_pico"}}
{"reqId":"21plAKFFC6ghsRMBomps","level":0,"time":"August 08, 2022 17:34:15","remoteAddr":**SENSITIVE DATA REMOVED**,"user":**SENSITIVE DATA REMOVED**,"app":"extract","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fcookbook%2F","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"extract"}}
{"reqId":"21plAKFFC6ghsRMBomps","level":0,"time":"August 08, 2022 17:34:15","remoteAddr":**SENSITIVE DATA REMOVED**,"user":**SENSITIVE DATA REMOVED**,"app":"keeweb","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fcookbook%2F","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"keeweb"}}
{"reqId":"21plAKFFC6ghsRMBomps","level":0,"time":"August 08, 2022 17:34:15","remoteAddr":**SENSITIVE DATA REMOVED**,"user":**SENSITIVE DATA REMOVED**,"app":"music","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fcookbook%2F","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"music"}}
{"reqId":"21plAKFFC6ghsRMBomps","level":0,"time":"August 08, 2022 17:34:15","remoteAddr":**SENSITIVE DATA REMOVED**,"user":**SENSITIVE DATA REMOVED**,"app":"qownnotesapi","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fcookbook%2F","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"qownnotesapi"}}
{"reqId":"21plAKFFC6ghsRMBomps","level":0,"time":"August 08, 2022 17:34:15","remoteAddr":**SENSITIVE DATA REMOVED**,"user":**SENSITIVE DATA REMOVED**,"app":"rainloop","method":"GET","url":"/ocs/v2.php/search/providers?from=%2Fapps%2Fcookbook%2F","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0","version":"24.0.3.2","data":{"app":"rainloop"}}
After i disabled debug level in WEBGUI log viewer i have found this messages about cookbook plugin:
[index] ΠΡΠΈΠ±ΠΊΠ°: Exception: OCA\Cookbook\Service\ThumbnailService::createThumbnail(): Return value must be of type string, null returned in file '**SENSITIVE DATA REMOVED**apps/cookbook/lib/Service/ThumbnailService.php' line 110 at <<closure>>
0. **SENSITIVE DATA REMOVED**lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Cookbook\Con ... {}, "create")
1. **SENSITIVE DATA REMOVED**lib/private/Route/Router.php line 298
OC\AppFramework\App::main("OCA\\Cookbook\\ ... r", "create", OC\AppFramework\ ... {}, ["cookbook.recipe.create"])
2. **SENSITIVE DATA REMOVED**lib/base.php line 1023
OC\Route\Router->match("/apps/cookbook/api/recipes")
3. **SENSITIVE DATA REMOVED**index.php line 36
OC::handleRequest()
POST /apps/cookbook/api/recipes
[PHP] ΠΡΠΈΠ±ΠΊΠ°: Error: Undefined variable $imagePath at **SENSITIVE DATA REMOVED**/cookbook/lib/Service/ThumbnailService.php#93 at <<closure>>
0. **SENSITIVE DATA REMOVED**/cookbook/lib/Service/ThumbnailService.php line 93
OC\Log\ErrorHandler::onError(2, "Undefined variable $imagePath", "/var/www/interv ... p", 93)
1. **SENSITIVE DATA REMOVED**/cookbook/lib/Service/ThumbnailService.php line 54
OCA\Cookbook\Service\ThumbnailService->createThumbnail(null, 256)
2. **SENSITIVE DATA REMOVED**/cookbook/lib/Helper/ImageService/ImageGenerationHelper.php line 70
OCA\Cookbook\Service\ThumbnailService->getThumbnail(null, 2)
3. **SENSITIVE DATA REMOVED**/cookbook/lib/Helper/ImageService/ThumbnailFileHelper.php line 96
OCA\Cookbook\Helper\ImageService\ImageGenerationHelper->generateThumbnail(OC\Files\Node\File {}, 2, OC\Files\Node\File {})
4. **SENSITIVE DATA REMOVED**/cookbook/lib/Helper/ImageService/ThumbnailFileHelper.php line 117
OCA\Cookbook\Helper\ImageService\ThumbnailFileHelper->recreateSingleThumbnail(OC\Files\Node\Folder {}, 2)
5. **SENSITIVE DATA REMOVED**/cookbook/lib/Service/ImageService.php line 137
OCA\Cookbook\Helper\ImageService\ThumbnailFileHelper->recreateThumbnails(OC\Files\Node\Folder {})
6. **SENSITIVE DATA REMOVED**/cookbook/lib/Service/RecipeService.php line 812
OCA\Cookbook\Service\ImageService->setImageData(OC\Files\Node\Folder {}, null)
7. **SENSITIVE DATA REMOVED**/cookbook/lib/Controller/RecipeController.php line 157
OCA\Cookbook\Service\RecipeService->addRecipe([0,"000","000"," ... "])
8. **SENSITIVE DATA REMOVED**/lib/private/AppFramework/Http/Dispatcher.php line 225
OCA\Cookbook\Controller\RecipeController->create()
9. **SENSITIVE DATA REMOVED**/lib/private/AppFramework/Http/Dispatcher.php line 133
OC\AppFramework\Http\Dispatcher->executeController(OCA\Cookbook\Con ... {}, "create")
10. **SENSITIVE DATA REMOVED**/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Cookbook\Con ... {}, "create")
11. **SENSITIVE DATA REMOVED**/lib/private/Route/Router.php line 298
OC\AppFramework\App::main("OCA\\Cookbook\\ ... r", "create", OC\AppFramework\ ... {}, ["cookbook.recipe.create"])
12. **SENSITIVE DATA REMOVED**/lib/base.php line 1023
OC\Route\Router->match("/apps/cookbook/api/recipes")
13. **SENSITIVE DATA REMOVED**/index.php line 36
OC::handleRequest()
POST /apps/cookbook/api/recipes
This issue was not updated for 45 days. It is therefore marked as stale. When no update occurs within the next 7 days, this issue will be closed automatically in the next 7 days.
Hello @intervisionlord again. First: Sorry that I left you alone for so long. I was sort of busy recently.
I just pushed out a new commit on the debug investigation branch. It is based on cookbook 0.9.15. If you are still running 0.9.14, I can rebase there as well. Here is the current build of the app.
It should now generate a bit more logs without accidentally triggering an exception.
Additionally, it will create and write a file /tmp/tmp-cookbook-img.jpg
. This file should contain the complete full-sized image that is processed. If you run into problems, please check this file if it is a valid image file and has a correct resolution.
I read through the logs once more and found a few things interesting:
Unfortunately, I have to close the issue, because at the moment there is not enough time for diagnostics. Most likely I will try to look for other solutions. I apologize for wasting your time.
Description Erros in creating recipes.
Reproduction Steps to reproduce the behavior:
Exception: Too few arguments to function OCA\FilesAccessControl\StorageWrapper::file_put_contents()
Expected behavior Correctly created recipe.
Actual behavior Error if recipe contains image
Versions Nextcloud server version: 23.0.4 Cookbook version: 0.9.11 Database system: mysql Ver 15.1 Distrib 10.2.29-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2