photos icon indicating copy to clipboard operation
photos copied to clipboard

getimagesizefromstring() : Corrupt JPEG data

Open kiv57 opened this issue 1 year ago • 17 comments

Describe the bug Since NC28 upgrade, log file is flooded with this error (about 10 times per minute) : getimagesizefromstring(): Corrupt JPEG data: 1 extraneous bytes before marker at /[NC path]/apps/photos/lib/Listener/SizeMetadataProvider.php#56

I ignored it before seeing long mariaDB queries generating heavy CPU load.

To Reproduce Steps to reproduce the behavior:

  1. Get NC 27 and Photos app fully working
  2. Upgrade NC from 27 to 28.0.1
  3. See repeated errors in log, and see CPU load and iowait >20%
  4. Disable Photos app => back to normal

Expected behavior

  • No error in log
  • Acceptable CPU load and IOwait

Server log getimagesizefromstring(): Corrupt JPEG data: 1 extraneous bytes before marker at /[NC path]/apps/photos/lib/Listener/SizeMetadataProvider.php#56

Additional context

  • Debian Bookworm
  • NC 28.0.1
  • MariaDB 11.2.2
  • PHP 8.2.14

kiv57 avatar Jan 04 '24 14:01 kiv57

Same here, log is flooded with these messages:

{"reqId":"iDD5Yttl2COiQvGYoWOM","level":3,"time":"2024-01-07T15:23:15+01:00","ree moteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"getimagess izefromstring(): Corrupt JPEG data: 3195 extraneous bytes before marker at /var// www/nextcloud/apps/photos/lib/Listener/SizeMetadataProvider.php#56","userAgent":: "--","version":"28.0.1.1","data":{"app":"PHP"}}

  • Debian Bookworm
  • NC 28.0.1.1
  • MariaDB 10.4.11
  • PHP 8.2.14

SaimenSays avatar Jan 11 '24 21:01 SaimenSays

I confirm the issue: MageIA 9, NC 28.0.1, mariadb-10.11.6-1.mga9, php-cli-8.2.14-1.mga9 I have not made further tests to say if it is only a cosmetic issue (flood in the logs and error message in the admin center), or if there is anything broken

HomeBoy38 avatar Jan 15 '24 06:01 HomeBoy38

I have not made further tests to say if it is only a cosmetic issue (flood in the logs and error message in the admin center), or if there is anything broken

It depends on what you call "broken" : the app seems to work correctly from the web UI point of view. But regarding the CPU load and io wait, due to permanent and heavy mysql requests, I decided to disable the app.

kiv57 avatar Jan 15 '24 09:01 kiv57

For instance, yes, it could have been Photos which would not work, you say it overcharge your machine which may be what I can tag as broken, let's see if it will be solved soon. On my side, I do not really use Photos, so I cannot really make more testing

HomeBoy38 avatar Jan 15 '24 18:01 HomeBoy38

I am seeing the same issue. A side effect that I noticed is that I have several years worth of photos that do not show up in the "All Media" view in the Photos tab (missing 2019 up to 3 weeks ago). However, if I go to the "Folders" view in the Photos tab, I can see all the missing photos there. The impacted photos seem to be missing all the information under their "details" view. These photos all had the correct details and were correctly displayed in the "All Media" view prior to updating to NC28.

RobTheBuilder2 avatar Jan 23 '24 15:01 RobTheBuilder2

I have absolutely no clue why, but the error stopped without any relevant action on my side

HomeBoy38 avatar Jan 24 '24 18:01 HomeBoy38

I was able to fix this by increasing my PHP allowed memory in the nextcloud configuration. Seems like it is consuming more memory in the latest update as compared to before. After increasing the memory, I did a re-scan of my photos from the command line and all my photos were showing up again. All the errors in my log file stopped happening as well.

RobTheBuilder2 avatar Jan 25 '24 16:01 RobTheBuilder2

@RobTheBuilder2 Can you please tell the exact parameter you have changed to avoid the error in the logs? Do you mean "memory_limit=512" in apache2/php.ini?

SaimenSays avatar Jan 25 '24 17:01 SaimenSays

On my side, I have memory_limit=512M in my config file

HomeBoy38 avatar Jan 25 '24 18:01 HomeBoy38

@RobTheBuilder2 Can you please tell the exact parameter you have changed to avoid the error in the logs? Do you mean "memory_limit=512" in apache2/php.ini?

I'm running nextcloud in a docker container, so my docker compose is using the environment variable configuration:

PHP_MEMORY_LIMIT=2048M

RobTheBuilder2 avatar Jan 25 '24 19:01 RobTheBuilder2

On my side, I have memory_limit=512M in my config file

Likely that is way low. I would suggest at least 2048M (2GB). Even with that limit set, I rarely, if ever, see NC memory grow above 500M.

RobTheBuilder2 avatar Jan 25 '24 19:01 RobTheBuilder2

I take it all back. After bumping my PHP memory limit, the problem went away for a few days. However, starting yesterday, I started to get the error again and now the 12G of PHP memory has been exceeded. Looks like a memory leak. Question is if this memory leak is a result of the exception handling or if hitting the memory limit is the actual cause of the errors. Either way, log file is flooded with the getimagesizefromstring() error again. Also, after getting into this state, the "All media" view no longer loads any photos. After I bounce my docker containers, "All Media" view starts to work properly again. Finally worth mentioning, while the PHP memory limit is set to 12G and there is an error message in NC log saying the limit was exceeded, my metrics show that there was never more than 800M claimed by the actual NC docker container. There is plenty of ram remaining on the server (32G) and for some reason, I get this memory limit exceeded error in PHP while it is only consuming 800M of the allowed 12G.

RobTheBuilder2 avatar Jan 29 '24 19:01 RobTheBuilder2

I would love this app to be usable again : is there any way to help with more feedback ?

kiv57 avatar Feb 18 '24 09:02 kiv57

Same issue after upgrading from 27.1.6 to 28.0.3 on a Raspberry Pi (NextCloudPi 1.53.2).

lovenemesis avatar Apr 09 '24 01:04 lovenemesis

Same issue here after upgrading from 27.x to 28.0.4. x86 computer.

PachisPachis avatar Apr 15 '24 19:04 PachisPachis

After upgrading from 27.1.4 to 28.0.5 I'm getting nextcloud.log flooded by messages very similar: Lots of them, the same reqId, I suspect is due the cronjob launched after the update

{
  "reqId": "xGyEKwWsfvdxTOSvwE34",
  "level": 3,
  "time": "2024-05-05T13:15:25+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "PHP",
  "method": "",
  "url": "--",
  "message": "getimagesizefromstring(): Corrupt JPEG data: 656 extraneous bytes before marker at /var/www/nextcloud/apps/photos/lib/Listener/SizeMetadataProvider.php#64",
  "userAgent": "--",
  "version": "28.0.5.1",
  "data": {
    "app": "PHP"
  },
  "id": "66379777e3366"
}

marcos-guerrero avatar May 05 '24 14:05 marcos-guerrero