Filter "Choose filter" page gives 502 Bad Gateway error

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
zmandme
Posts: 2
Joined: Wed Feb 22, 2023 11:06 am

Filter "Choose filter" page gives 502 Bad Gateway error

Post by zmandme »

Hi all, I am new to ZoneMinder and am happy I got it working :) (Using the plugin on TrueNas)
I did however ran into an issue. After I added a second custom filter, the "choose filter" page keeps giving a "502 Bad Gateway" error. (https://IP/zm/index.php?view=filter&Id=) When I remove the second custom filter, the error disappears. Also, the individual filters are shown properly and seem to be working (https://IP/zm/index.php?view=filter&Id=4).

Looking at the entries in the db did not really give me a clue (see below).

Does anyone have a suggestion what may be wrong or how to resolve this?

Thanks, Jasper

Code: Select all


dbadmin@localhost [zm]> SELECT * FROM filters;
+----+----------------------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------------+-----------+------------+-----------+---------+--------------+-----------+-------------+-------------+----------------+------------+----------+------------+----------+------------+-----------------+------------+------------+----------+
| Id | Name                 | UserId | Query_json                                                                           | AutoArchive | AutoUnarchive | AutoVideo | AutoUpload | AutoEmail | EmailTo | EmailSubject | EmailBody | AutoMessage | AutoExecute | AutoExecuteCmd | AutoDelete | AutoMove | AutoMoveTo | AutoCopy | AutoCopyTo | UpdateDiskSpace | Background | Concurrent | LockRows |
+----+----------------------+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+---------------+-----------+------------+-----------+---------+--------------+-----------+-------------+-------------+----------------+------------+----------+------------+----------+------------+-----------------+------------+------------+----------+
|  1 | PurgeWhenFull        |      1 | {"sort_field":"Id","terms":[{"val":0,"attr":"Archived","op":"="},{"cnj":"and","val":95,"attr":"DiskPercent","op":">="},{"cnj":"and","obr":"0","attr":"EndDateTime","op":"IS NOT","val":"NULL","cbr":"0"}],"limit":100,"sort_asc":1}                                                 |       0 |             0 |         0 |          0 |         0 |         |       |           |           0 |           0 |                |          1 |      0 |          0 |        0 |          0 |               0 |          1 |       0 |        0 |
|  2 | Update DiskSpace     |      1 | {"terms":[{"attr":"DiskSpace","op":"IS","val":"NULL"},{"cnj":"and","obr":"0","attr":"EndDateTime","op":"IS NOT","val":"NULL","cbr":"0"}]}                                                                           |       0 |             0 |         0 |          0 |         0 |         |       |           |           0 |           0 |                |          0 |      0 |          0 |        0 |          0 |               1 |          1 |       0 |        0 |
|  4 | PurgeCam1After3Days |      1 | {"terms":[{"obr":"0","attr":"Archived","op":"=","val":"0","cbr":"0"},{"cnj":"and","obr":"0","attr":"EndDate","op":"<","val":"-3 days","cbr":"0"},{"cnj":"and","obr":"0","attr":"MonitorId","op":"=","val":"1","cbr":"0"}],"sort_field":"StartDateTime","sort_asc":"1","limit":"10"} |       0 |             0 |         0 |          0 |         0 |         |       |           |           0 |           0 |                |          1 |      0 |          0 |        0 |          0 |               0 |          1 |       0 |        0 |
|  6 | PurgeAllAfter14Days  |      1 | {"terms":[{"attr":"Archived","op":"=","val":"0"},{"cnj":"and","attr":"EndDate","op":"=","val":"-14 days"}],"sort_field":"StartDateTime","sort_asc":"1","limit":"100"}                                                                           |       0 |             0 |         0 |          0 |         0 |         |       |           |           
zmandme
Posts: 2
Joined: Wed Feb 22, 2023 11:06 am

Re: Filter "Choose filter" page gives 502 Bad Gateway error

Post by zmandme »

Sorry for the bump --- problem persists...
User avatar
iconnor
Posts: 2880
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Filter "Choose filter" page gives 502 Bad Gateway error

Post by iconnor »

The change in column alignment makes me think maybe there is a non-utf8 character in the name... or something.

I would go looking at the javascript console and network tab after Right click -> Inspect Element.

Gotta be some info there
rpschoen
Posts: 1
Joined: Thu Jun 15, 2023 7:55 pm

Re: Filter "Choose filter" page gives 502 Bad Gateway error

Post by rpschoen »

I also run ZoneMinder on TrueNAS, but installed manually in a jail, not using the plugin. I recently got around to updating the jail (FreeBSD release, packages, etc) including mysql57 to mysql80 and ZoneMinder 1.34 to 1.36, and had a very similar problem.

Strangely, I was able to view the main filters page, but I would get the "502 Bad Gateway" as soon as I selected a filter in the "Choose Filter" drop-down, which I think is the opposite of the OP problem.

Looking through various logs, I found the following in the nginx error log:

Code: Select all

[error] 59298#100974: *237 upstream sent too big header while reading response header from upstream, client: 192.168.xxx.xxx, server: , request: "GET /zm/index.php?view=filter&Id=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:"
After searching that, I found a suggestion to add the following to nginx.conf:

Code: Select all

fastcgi_buffers 16 16k; 
fastcgi_buffer_size 32k;
I'm not even sure what the best values would be, or where in the file it really needs to be, but I added it to my

Code: Select all

server {
}
block, and that seems to have solved the problem for me.
Post Reply