LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.42k stars 303 forks source link

Some albums loading OK, some get "Server Error or API not found" #1110

Closed gdureuil closed 3 years ago

gdureuil commented 3 years ago

Detailed description of the problem [REQUIRED]

Some of my albums have problem loading, with message "Server Error or API not found". Otehrs load OK.

Steps to reproduce the issue

Steps to reproduce the behavior: My install is at https://screenshots.baka-gamer.net and hosts gaming screenshots Try album named "A Hat In Time (SWITCH)", it loads OK. Try album named "Animal Crossing New Horizon (SWITCH)", it gives error "Server Error or API not found". Album is never accessible.

Output of the diagnostics [REQUIRED]

Diagnostics
-------
Warning: Dropbox import not working. dropbox_key is empty.
Warning: lossless_optimization set to 1 but cwebp not found!
Warning: lossless_optimization set to 1 but svgo not found!
Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.

System Information
--------------
Lychee Version (git):            master (3d46ab0) - Data not in Cache
DB Version:                      4.3.5

composer install:                --no-dev
APP_ENV:                         local
APP_DEBUG:                       false

System:                          Linux
PHP Version:                     8
Max uploaded file size:          100M
Max post size:                   100M
MySQL Version:                   10.3.29-MariaDB-0+deb10u1-log

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1690
GD Version:                      2.2.5

Config Information
--------------
version:                         040305
check_for_updates:               0
sorting_Photos_col:              title
sorting_Photos_order:            ASC
sorting_Albums_col:              title
sorting_Albums_order:            ASC
imagick:                         1
skip_duplicates:                 1
small_max_width:                 0
small_max_height:                360
medium_max_width:                1920
medium_max_height:               1080
lang:                            fr
layout:                          0
image_overlay_type:              none
default_license:                 none
compression_quality:             90
full_photo:                      1
delete_imported:                 0
Mod_Frame:                       1
Mod_Frame_refresh:               30
thumb_2x:                        1
small_2x:                        1
medium_2x:                       1
landing_page_enable:             0
landing_owner:                   
landing_title:                   
landing_subtitle:                
landing_facebook:                
landing_flickr:                  
landing_twitter:                 
landing_instagram:               
landing_youtube:                 
landing_background:              
site_title:                      BakaGamer - Screenshots
site_copyright_enable:           0
site_copyright_begin:            2010
site_copyright_end:              2021
additional_footer_text:          
display_social_in_gallery:       0
public_search:                   0
SL_enable:                       0
SL_for_admin:                    0
public_recent:                   0
recent_age:                      1
public_starred:                  0
downloadable:                    0
photos_wraparound:               1
map_display:                     0
zip64:                           1
map_display_public:              0
map_provider:                    Wikimedia
force_32bit_ids:                 0
map_include_subalbums:           0
update_check_every_days:         3
has_exiftool:                    0
share_button_visible:            0
import_via_symlink:              0
has_ffmpeg:                      1
location_decoding:               0
location_decoding_timeout:       30
location_show:                   0
location_show_public:            0
rss_enable:                      0
rss_recent_days:                 7
rss_max_items:                   100
prefer_available_xmp_metadata:   0
editor_enabled:                  1
lossless_optimization:           1
swipe_tolerance_x:               150
swipe_tolerance_y:               250
local_takestamp_video_formats:   .avi|.mov
log_max_num_line:                1000
unlock_password_photos_with_url_param: 0
nsfw_visible:                    1
nsfw_blur:                       0
nsfw_warning:                    1
nsfw_warning_admin:              0
map_display_direction:           1
album_subtitle_type:             oldstyle
upload_processing_limit:         3
public_photos_hidden:            1
new_photos_notification:         0

Browser and system

Windows 10 21H1 Family Firefox 92.0.1 x64 Edge 94.0.992.38 x64

ildyria commented 3 years ago

Hi. That is indeed weird.

As it is, we are missing information to debug it. Can you apply the steps in the following links?

This will help us tremendously. :+1:

gdureuil commented 3 years ago

In browser debugger, in network tab, I get this when clicking on a problem album (I masked tokens and cookies) image

I enabled APP_DEBUG to true, but I have no more information. What can I provide you ?

gdureuil commented 3 years ago

I'm starting to think the problems came from artisan migrate on my latest updates. I'm using php8 as cli and fpm, and I think there were warnings during the latest migrate. Is PHP8 fully supported with Lychee ?

EDIT: I'll try restoring a backup from 2 days after last image upload and upgrade again. Will take some time.

gdureuil commented 3 years ago

OK i did a last test before trying a restore. I switched back to php7.4-fpm instead of php8.0-fpm for Lychee. The albums with problems seem to work now.

Seems like you have problems with php8.

Here is the new diagnostic after change php version.

Diagnostics
-------
Warning: Dropbox import not working. dropbox_key is empty.
Warning: lossless_optimization set to 1 but cwebp not found!
Warning: lossless_optimization set to 1 but svgo not found!
Warning: You may experience problems when uploading a large amount of photos. Take a look in the FAQ for details.
Info: Latest version of PHP is 8

System Information
--------------
Lychee Version (git):            master (3d46ab0) - Data not in Cache
DB Version:                      4.3.5

composer install:                --no-dev
APP_ENV:                         local
APP_DEBUG:                       true

System:                          Linux
PHP Version:                     7.4
Max uploaded file size:          100M
Max post size:                   100M
MySQL Version:                   10.3.29-MariaDB-0+deb10u1-log

Imagick:                         1
Imagick Active:                  1
Imagick Version:                 1690
GD Version:                      2.2.5

I have been using php8 for some time now on Lychee so it seems you have a regression somewhere.

ildyria commented 3 years ago

I have been using php8 for some time now on Lychee so it seems you have a regression somewhere.

Lychee should be fully compatible with php8. So yes I'm surprised.

I enabled APP_DEBUG to true, but I have no more information. What can I provide you ?

you needed to go in the response tab. That is where more info would have appeared. :)

gdureuil commented 3 years ago

OK i'll switch back temporarily to php8-fpm to diagnose that, APP_DEBUG set to true. Here is the response on that error 500, json format.

{
    "message": "round(): Argument #1 ($num) must be of type int|float, string given",
    "exception": "TypeError",
    "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Models/Extensions/PhotoCast.php",
    "line": 72,
    "trace": [
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Models/Extensions/PhotoCast.php",
            "line": 72,
            "function": "round"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Actions/Album/Photos.php",
            "line": 69,
            "function": "toReturnArray",
            "class": "App\\Models\\Photo",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Actions/Album/Prepare.php",
            "line": 41,
            "function": "get",
            "class": "App\\Actions\\Album\\Photos",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Http/Controllers/AlbumController.php",
            "line": 87,
            "function": "do",
            "class": "App\\Actions\\Album\\Prepare",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
            "line": 54,
            "function": "get",
            "class": "App\\Http\\Controllers\\AlbumController",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
            "line": 45,
            "function": "callAction",
            "class": "Illuminate\\Routing\\Controller",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 254,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 197,
            "function": "runController",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 695,
            "function": "run",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 128,
            "function": "Illuminate\\Routing\\{closure}",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Http/Middleware/ReadCheck.php",
            "line": 76,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "App\\Http\\Middleware\\ReadCheck",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
            "line": 50,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
            "line": 78,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/app/Http/Middleware/VerifyCsrfToken.php",
            "line": 61,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "App\\Http\\Middleware\\VerifyCsrfToken",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php",
            "line": 39,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Session\\Middleware\\AuthenticateSession",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",
            "line": 49,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
            "line": 121,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
            "line": 64,
            "function": "handleStatefulRequest",
            "class": "Illuminate\\Session\\Middleware\\StartSession",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Session\\Middleware\\StartSession",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
            "line": 37,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
            "line": 67,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 103,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 697,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 672,
            "function": "runRouteWithinStack",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 636,
            "function": "runRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 625,
            "function": "dispatchToRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 166,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 128,
            "function": "Illuminate\\Foundation\\Http\\{closure}",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/bepsvpt/secure-headers/src/SecureHeadersMiddleware.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Bepsvpt\\SecureHeaders\\SecureHeadersMiddleware",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
            "line": 31,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
            "line": 40,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
            "line": 86,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/fideloper/proxy/src/TrustProxies.php",
            "line": 57,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Fideloper\\Proxy\\TrustProxies",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 103,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 141,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 110,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/home/www-data/www/baka-gamer.net/screenshots/public/index.php",
            "line": 74,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        }
    ]
}
kamil4 commented 3 years ago

Thanks for that latest info -- it provided all the clues we needed!

So the problem is triggered by videos. @ildyria couldn't reproduce it because he hates videos and probably doesn't even have any in his instance :wink:.

Thankfully it appears to be a trivial bug requiring a one-liner fix. I'm still running php7.4 though so my fix is untested. @gdureuil, would you mind giving it a spin? The fix is in #1113. If applying patches isn't your thing, you can simply replace the file Lychee/app/Models/Extensions/PhotoCast.php in your installation with the contents of https://raw.githubusercontent.com/LycheeOrg/Lychee/fix-1110/app/Models/Extensions/PhotoCast.php. Let us know if it works!

gdureuil commented 3 years ago

I did a "git pull" as I see you put the fix in master. Configured my install back to php8.0 and problem albums are now working again.

Thank you very much for the fix !