FC6 - 1.22.1 to 1.23.1 upgraded, but can't view Events?

Support and queries relating to all previous versions of ZoneMinder
Locked
sck_nogas
Posts: 25
Joined: Thu Jun 14, 2007 4:46 pm

FC6 - 1.22.1 to 1.23.1 upgraded, but can't view Events?

Post by sck_nogas »

On my home server...

Code: Select all

[sck@house ~]$ cat /etc/fedora-release 
Fedora Core release 6 (Zod)
[sck@house ~]$ uname -a
Linux house.nogas.org 2.6.22.14-72.fc6 #1 SMP Wed Nov 21 15:12:59 EST 2007 i686 i686 i386 GNU/Linux
I've had a wonderful working 1.22.1 system for months, and have been very happy with everything. But a few weeks ago, I got the pop-up for the new version, downloaded, configured, updated packages, re-configured, compiled, then installed.

But, I could not get the old database to load, so I followed the instructions in the Wiki and ran 'zmupdate.pl –version=1.22.1'

Now, the main page loads, and I think everything is fine, until I try to look at an event and get a blank window.

So, I followed the hints given in this thread and enabled $db_debug in zm_db.php and now in the error_log I see this...

Code: Select all

[Wed Feb 06 22:21:45 2008] [error] [client 192.168.8.104] SQL-DEBUG: select E.*,M.Name as MonitorName,M.Width,M.Height,M.DefaultRate,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = '354264', referer: http://192.168.8.4:81/zm/index.php?view=events&page=1&filter[terms][0][attr]=Archived&filter[terms][0][op]==&filter[terms][0][val]=0&filter[terms][1][cnj]=and&filter[terms][1][attr]=DateTime&filter[terms][1][op]=%3E=&filter[terms][1][val]=-1+month&filter[terms][2][cnj]=and&filter[terms][2][attr]=MonitorId&filter[terms][2][op]==&filter[terms][2][val]=8
[Wed Feb 06 22:21:45 2008] [error] [client 192.168.8.104] SQL-DEBUG: select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.StartTime <= '2008-01-12 10:15:42' order by E.StartTime desc, referer: http://192.168.8.4:81/zm/index.php?view=events&page=1&filter[terms][0][attr]=Archived&filter[terms][0][op]==&filter[terms][0][val]=0&filter[terms][1][cnj]=and&filter[terms][1][attr]=DateTime&filter[terms][1][op]=%3E=&filter[terms][1][val]=-1+month&filter[terms][2][cnj]=and&filter[terms][2][attr]=MonitorId&filter[terms][2][op]==&filter[terms][2][val]=8
[Wed Feb 06 22:21:45 2008] [error] [client 192.168.8.104] SQL-DEBUG: select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.StartTime <= '2008-01-12 10:15:42' order by E.StartTime desc, referer: http://192.168.8.4:81/zm/index.php?view=events&page=1&filter[terms][0][attr]=Archived&filter[terms][0][op]==&filter[terms][0][val]=0&filter[terms][1][cnj]=and&filter[terms][1][attr]=DateTime&filter[terms][1][op]=%3E=&filter[terms][1][val]=-1+month&filter[terms][2][cnj]=and&filter[terms][2][attr]=MonitorId&filter[terms][2][op]==&filter[terms][2][val]=8
[Wed Feb 06 22:21:53 2008] [error] [client 192.168.8.104] PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried to allocate 40 bytes) in /home/zm/zm_db.php on line 99, referer: http://192.168.8.4:81/zm/index.php?view=events&page=1&filter[terms][0][attr]=Archived&filter[terms][0][op]==&filter[terms][0][val]=0&filter[terms][1][cnj]=and&filter[terms][1][attr]=DateTime&filter[terms][1][op]=%3E=&filter[terms][1][val]=-1+month&filter[terms][2][cnj]=and&filter[terms][2][attr]=MonitorId&filter[terms][2][op]==&filter[terms][2][val]=8
Allowed memory size of 16777216 bytes exhausted (tried to allocate 10 bytes)
Hmmm, that doesn't look good. I was clicking on a single event. So, I recheck the Forum and find the same thread and after re-reading it, I decide to run a mysqlcheck (in extended mode) and it says...

Code: Select all

[sck@house zm]$ mysqlcheck -u root -pSECRET_PASSWRD_YO! -e zm
zm.Config                                          OK
zm.ControlPresets                                  OK
zm.Controls                                        OK
zm.Devices                                         OK
zm.Events                                          OK
zm.Filters                                         OK
zm.Frames                                          OK
zm.Groups                                          OK
zm.MonitorPresets                                  OK
zm.Monitors                                        OK
zm.States                                          OK
zm.Stats                                           OK
zm.TriggersX10                                     OK
zm.Users                                           OK
zm.ZonePresets                                     OK
zm.Zones                                           OK
[sck@house zm]$ 
So, the database says it's okay, but the problem I have is when I click on a link like ...

Code: Select all

javascript: eventWindow( '/zm/index.php?view=event&eid=354264&filter[terms][0][attr]=Archived&filter[terms][0][op]==&filter[terms][0][val]=0&filter[terms][1][cnj]=and&filter[terms][1][attr]=DateTime&filter[terms][1][op]=>=&filter[terms][1][val]=-1+month&filter[terms][2][cnj]=and&filter[terms][2][attr]=MonitorId&filter[terms][2][op]==&filter[terms][2][val]=8&sort_field=DateTime&sort_asc=1&page=1', 'zmEvent', 336, 348 );
I try to do mysql queries which are WAY too big...

For instance, if I manually send the SQL-DEBUG commands to mysql (password changed BTW :P ) I see the following...

Code: Select all

[sck@house zm]$ echo "select E.*,M.Name as MonitorName,M.Width,M.Height,M.DefaultRate,M.DefaultScale from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.Id = '354264'" | mysql -u zmuser -pzm_passwd -D zm | wc -l
2
[sck@house zm]$ echo "select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.StartTime <= '2008-01-12 10:15:42' order by E.StartTime desc" | mysql -u zmuser -pzm_passwd -D zm | wc -l
106224
[sck@house zm]$ echo "select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where E.StartTime <= '2008-01-12 10:15:42' order by E.StartTime desc" | mysql -u zmuser -pzm_passwd -D zm | wc -l
106224
So, in order to display a single event, I need to pull 106,224 things out of the database? Umm, what is wrong with my host?

Scott
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Are you trying to use the timeline view or the list view? If so what are you clicking to generate it?

The memory error you are getting is a PHP specific one and is related to exceeding the max amount of memory that it is allowed to use. It looks like yours it set to 16Mb but I always set it to 32Mb at least. You can do this by editing your php.ini file (usually, but not always, in /etc) and grepping for 'memory_limit'. Set that to 32M, restart apache and see what happens. It may not make any difference if the events you want add up to 64M for instance but it might help.

If you are using the timeline view and want to use the list view instead (which only shows a few events at a time) this can be changed in the appropriate bandwidth section of the Options.
Phil
sck_nogas
Posts: 25
Joined: Thu Jun 14, 2007 4:46 pm

Post by sck_nogas »

The exact steps I did was....

Code: Select all

1:Connect to Web page
2:Click on one cameras "day" view, a List view window opens
3:In the list view, click on a single Event, an Event window opens
4:But, there's nothing in the Event window.
Does that help?

Scott
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes. I think I can see where there may be an issue so I will get back to you.

As a quick hack you could try editing zm_html_view_event.php and then find the line

Code: Select all

$sql = "select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sort_column ".($sort_order=='asc'?'<=':'>=')." '".$event[preg_repla
ce( '/^.*\./', '', $sort_column )]."'$filter_sql$mid_sql order by $sort_column ".($sort_order=='asc'?'desc':'asc');
and change it to

Code: Select all

$sql = "select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sort_column ".($sort_order=='asc'?'<=':'>=')." '".$event[preg_repla
ce( '/^.*\./', '', $sort_column )]."'$filter_sql$mid_sql order by $sort_column ".($sort_order=='asc'?'desc':'asc')." limit 50";
and add the limit clause to the next statement also.

This is not necessarily a fix, just a diagnostic suggestion really.
Phil
sck_nogas
Posts: 25
Joined: Thu Jun 14, 2007 4:46 pm

Post by sck_nogas »

Okay, I've made the change and the page opens. Now I need to debug why I can't see the images. :(

However, I do now see this error in the apache error_log

Code: Select all

[Fri Feb 08 00:48:01 2008] [error] [client 192.168.8.107] PHP Warning:  mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/zm/zm_db.php on line 111, referer: http://192.168.8.4:81/zm/index.php?view=events&page=1&filter[terms][0][attr]=Archived&filter[terms][0][op]==&filter[terms][0][val]=0&filter[terms][1][cnj]=and&filter[terms][1][attr]=DateTime&filter[terms][1][op]=%3E=&filter[terms][1][val]=-1+hour&filter[terms][2][cnj]=and&filter[terms][2][attr]=MonitorId&filter[terms][2][op]==&filter[terms][2][val]=3
Any hints?

Scott
PS> I upped my php memory_limit to 32m as well
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Is there anything before that error? I would expect it to not be alone.

What do you see instead of images? Nothing or a broken image link etc?
Phil
sck_nogas
Posts: 25
Joined: Thu Jun 14, 2007 4:46 pm

Post by sck_nogas »

Strange. This morning I got the pop-up reminding me to upgrade? So, I'm going to start from scratch. See if it was a migration issue, a 1.22.3 against 1.23.1 issue, or Fedora Core 6 being cranky.

So, I'm going to do a re-install of FC8, and then set up all packages again.

Will update when done.

Scott
sck_nogas
Posts: 25
Joined: Thu Jun 14, 2007 4:46 pm

Post by sck_nogas »

Well, Merde...

Can't reproduce the issue after a complete re-install. Guess I made a mistake somewhere, but now I've documented the necessary steps to get a working FC8 selinux configuration of my home server.

This issue is a non-issue. (But I've got a new one forming in my head...)

Scott
Locked