HTTP 500 Errors

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
bbawkon
Posts: 5
Joined: Tue Jun 06, 2023 2:32 am

HTTP 500 Errors

Post by bbawkon »

Hello everyone,

Running 1.36.33 on Ubuntu 22.04

Most everything is working properly, but a few things yield an HTTP 500 Error. Looking at event frames, for instance, is one such thing.

visiting

Code: Select all

http://zoneminder/zm/index.php?view=frame&eid=458&fid=380
gives HTTP ERROR 500.
Apache error.log stores:

Code: Select all

[Mon Jun 05 22:35:01.586436 2023] [php:error] [pid 12856] [client 192.168.101.14:64203] PHP Fatal error:  Uncaught ValueError:
  imagecreatetruecolor(): Argument #1 ($width) must be greater than 0 in /usr/share/zoneminder/www/includes/Event.php:473\nStack 
  trace:\n#0 /usr/share/zoneminder/www/includes/Event.php(473): imagecreatetruecolor()\n#1 
  /usr/share/zoneminder/www/skins/classic/views/frame.php(63): ZM\\Event->getImageSrc()\n#2 
  /usr/share/zoneminder/www/index.php(282): require_once('...')\n#3 
  {main}\n  thrown in /usr/share/zoneminder/www/includes/Event.php on line 473,
   referer: http://zoneminder/zm/index.php?view=frames&eid=458
Any thoughts? Google was no help, unfortunately.
bbawkon
Posts: 5
Joined: Tue Jun 06, 2023 2:32 am

Re: HTTP 500 Errors

Post by bbawkon »

"View Matches" of a Filter also throws HTTP Error 500.

Code: Select all

http://zoneminder/zm/index.php?view=montagereview&action=&object=filter&filter%5BName%5D=PurgeWhenFull&filter%5BQuery%5D%5Bterms%5D%5B0%5D%5Bobr%5D=0&filter%5BQuery%5D%5Bterms%5D%5B0%5D%5Battr%5D=Archived&filter%5BQuery%5D%5Bterms%5D%5B0%5D%5Bop%5D=%3D&filter%5BQuery%5D%5Bterms%5D%5B0%5D%5Bval%5D=0&filter%5BQuery%5D%5Bterms%5D%5B0%5D%5Bcbr%5D=0&filter%5BQuery%5D%5Bterms%5D%5B1%5D%5Bcnj%5D=and&filter%5BQuery%5D%5Bterms%5D%5B1%5D%5Bobr%5D=0&filter%5BQuery%5D%5Bterms%5D%5B1%5D%5Battr%5D=DiskPercent&filter%5BQuery%5D%5Bterms%5D%5B1%5D%5Bop%5D=%3E%3D&filter%5BQuery%5D%5Bterms%5D%5B1%5D%5Bval%5D=80&filter%5BQuery%5D%5Bterms%5D%5B1%5D%5Bcbr%5D=0&filter%5BQuery%5D%5Bterms%5D%5B2%5D%5Bcnj%5D=and&filter%5BQuery%5D%5Bterms%5D%5B2%5D%5Bobr%5D=0&filter%5BQuery%5D%5Bterms%5D%5B2%5D%5Battr%5D=EndDateTime&filter%5BQuery%5D%5Bterms%5D%5B2%5D%5Bop%5D=IS%20NOT&filter%5BQuery%5D%5Bterms%5D%5B2%5D%5Bval%5D=NULL&filter%5BQuery%5D%5Bterms%5D%5B2%5D%5Bcbr%5D=0&filter%5BQuery%5D%5Bsort_field%5D=Id&filter%5BQuery%5D%5Bsort_asc%5D=1&filter%5BQuery%5D%5Blimit%5D=100&filter%5BAutoExecuteCmd%5D=&filter%5BAutoDelete%5D=1&filter%5BAutoCopyTo%5D=&filter%5BAutoMoveTo%5D=&filter%5BBackground%5D=1&filter%5BEmailTo%5D=&filter%5BEmailSubject%5D=&filter%5BEmailBody%5D=
With apache error.log of:

Code: Select all

[Mon Jun 05 22:40:18.686450 2023] [php:warn] [pid 12831] [client 192.168.101.14:64539] PHP Warning:
Undefined array key "attr" in /usr/share/zoneminder/www/skins/classic/views/
montagereview.php on line 105, referer: http://zoneminder/zm/index.php?view=filter&Id=1
[Mon Jun 05 22:40:18.686568 2023] [php:error] [pid 12831] [client 192.168.101.14:64539] PHP Fatal error:
Uncaught TypeError: Cannot access offset of type string on string in
/usr/share/zoneminder/www/skins/classic/views/montagereview.php:105\nStack trace:\n#0
/usr/share/zoneminder/www/index.php(282): require_once()\n#1
{main}\n  thrown in /usr/share/zoneminder/www/skins/classic/views/montagereview.php on line 105,
referer: http://zoneminder/zm/index.php?view=filter&Id=1
bbawkon
Posts: 5
Joined: Tue Jun 06, 2023 2:32 am

Re: HTTP 500 Errors

Post by bbawkon »

Did a little more investigation.

When viewing frames, the HTTP 500 and associated errors are only produced if WEB_x_SCALE_THUMBS is enabled. Turning that option off solves the issue.

I added a little debug code to Event.php, and with WEB_x_SCALE_THUMBS available, $fraction (around line 449) is 0.00 before being passed to imagecreatetruecolor()

Any thoughts on what could cause that?

I'm still working backward, but I'm hopeful someone who knows more about ZM code than I do has an idea.

Using Medium B/W as an example,
WEB_M_DEFAULT SCALE = 50
WEB_M_SCALE_THUMBS = YES
WEB_RESIZE_CONSOLE = YES
WEB_LIST_THUMB_WIDTH = 48
WEB_LIST_THUMB_HEIGHT = 0
WEB_LIST_THUMBS = YES
WEB_ANIMATE_THUMBS = YES

Thanks,
Ben
Post Reply