after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Discussions related to the 1.36.x series of ZoneMinder
dvsing
Posts: 2
Joined: Tue Jun 07, 2022 5:35 pm

after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by dvsing »

After upgrading from 1.36.16 to 1.36.17, My montage video will go blank/white a few seconds after loading (initially all video loads up, but then most are replaced with blank/white squares), and in the log I see web_php reporting "Unable to get semaphore.". I also see no video when I look at the live view for any given camera. Running Centos 7.

Let me know what additional diagnostics data I can provide. I suspect this is related to this item in the 1.36.17 changelog:
- implement semaphore retry when talking to zms

??

Dan
dvsing
Posts: 2
Joined: Tue Jun 07, 2022 5:35 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by dvsing »

Ahh... important observation: This happens on Safari. If I use Chrome, the montage appears to come up but then the web UI completely freezes/doesn't respond to clicks. Have to close the tab and re-navigate. Lots of "unable to get semaphore" in the log.
spanningtree
Posts: 1
Joined: Tue Jun 07, 2022 11:01 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by spanningtree »

I'm seeing this as well, but not with a montage, just a single stream or even just on the homepage when it is pulling in the thumbnails

Code: Select all

[root@watcher /]# yum list installed | grep zone
zoneminder-common.x86_64                 1.36.17-1.el8    
zoneminder-nginx.x86_64                  1.36.17-1.el8     
[root@watcher /]# cat /etc/redhat-release
Rocky Linux release 8.6 (Green Obsidian)
[root@watcher /]# uname -a
Linux watcher 4.18.0-372.9.1.el8.x86_64 #1 SMP Tue May 10 14:48:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@watcher /]# php -v
PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS )
RudiFueller
Posts: 7
Joined: Mon Sep 07, 2020 9:19 am

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by RudiFueller »

Same here, also Rocky Linux, also 1.36.17.
al_bullit
Posts: 1
Joined: Wed Jun 08, 2022 10:51 am

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by al_bullit »

I am seeing this same thing. Pre-update all was fine, now viewing feeds just flicks up a single frame and then breaks (Mac, Chrome. In Safari I don't see the single frame, its just blank). Recordings are all working fine (inc in browser playback), its just real time viewing that breaks. I don't see any issues with semaphore availability or over use on the machine, ipcs shows normal things you would expect.

Code: Select all

[root@zoneminder ~]# ipcs

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x4e1458f7 2          root       600        1000       10                      

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x00000000 24         apache     600        1         
0x00000000 25         apache     600        1         
0x00000000 26         apache     600        1         
0x00000000 27         apache     600        1         
0x00000000 28         apache     600        1         
0xffffffff 29         apache     666        3         
0x5a00e993 30         apache     666        3         

[root@zoneminder ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@zoneminder ~]# yum list installed | grep zone
zoneminder.x86_64                      1.36.17-1.el7                   @rpmfusion-free-updates
zoneminder-common.x86_64               1.36.17-1.el7                   @rpmfusion-free-updates
zoneminder-httpd.x86_64                1.36.17-1.el7                   @rpmfusion-free-updates
nabbi
Posts: 7
Joined: Mon Jun 06, 2022 7:12 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by nabbi »

There might be some overlap with thread Pause button appears not to work in live streaming
pull 3501 was merged into main branch, not included in a 1.36 release yet to my knowledge.

An possible alternative is to install php System V semaphore, as this bug appears to impact systems without it present. Yet I could be mistaken :wink:

However, I also still seeing some freezing in my webui. Have to close the Firefox 91.9.1esr tab and reopen ZM, finding both the client and server cpu are taxed. There seems to be a few events stuck in the "new event" name and that might be what's triggering high cpu issue for me, as most other events playback. So there might be something else going on here as well.
penataquit
Posts: 6
Joined: Sat Sep 22, 2018 3:08 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by penataquit »

I'm having this issue now as well on 1.36.17, the live feeds flicker when viewed in any web browser and logs fill up with "unable to get semaphore." Did not have this on 1.36.16. Don't think it's related to PHP sysvsem availability as my installation has that module included and enabled.
penataquit
Posts: 6
Joined: Sat Sep 22, 2018 3:08 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by penataquit »

Another discovery: if you comment out the ajaxError function at line 1906 of /usr/share/zoneminder/www/includes/functions.php, the errors obviously stop getting logged but also the live video flickering stops.

Also, clicking to zoom in live view is now broken entirely. In the last couple of releases it was not working right, briefly zooming in before returning to full-size view without input, but now clicking does nothing at all.
jogo
Posts: 46
Joined: Thu Aug 03, 2017 3:00 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by jogo »

I can also see the flickering and
Unable to get semaphore. js_MonitorStream-dark-1654027610.js:493:15
is printed on the console. Zoneminder seems to be a bit of a construction site at the moment. My rendering problem of .16 is gone, but .17 doesn't seem perfect yet and I'm now waiting for .18 to appear in the repository.
snakeice
Posts: 7
Joined: Mon Oct 15, 2018 9:14 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by snakeice »

My images aren't blank but when viewing a single camera from console or in montage mode my stream flickers. Montage view or events there's no flicker or stutter. This just started happening when I updated to 1.36.17.

I originally thought it was a system issue as I had drive issues and a kernel rebuild issue updating to Rocky Linux 8.6 and that update updated Zoneminder to 1.36.17. I booted an older kernel plus I have a drive that needs replacing so was thinking that was the issue until I got Zoneminder up on a VM.
The VM also has Rocky Linux 8.6 latest patches etc. and that's where I noticed the flickering issue. I dedicated more RAM and CPU to the VM and still noted the issues and then I noticed the physical system also had flickering images when viewing. Then thought network since both systems were having the same behavior. I logged directly into my IP camera and that image was fine. Then found this thread.

I tried commenting out the ajax error in /usr/share/zoneminder/www/includes/functions.php but I had no images after that. My events are recording fine I'll wait and view montage review. I will try some other fixes and check back here.

In the UI I get the error "Unable to get semaphore" followed by "Unable to send stream frame: Broke pipe" on the next line at times.

Plenty of CPU and memory on the physical system and the VM I will allocate more but seems this issue is not resource related for the streams flickering.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by rockedge »

I have seen these same errors for quite a few versions built from source master branch on Puppy Linux and Void Linux.
Same Montage viewing errors, orphaned nph-zms instances and broken pipes.

Now for the last few versions also the single stream views will not work. They appear for an instant correctly sized but then disappear.
jimrif
Posts: 2
Joined: Sun Jun 12, 2022 3:58 am

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by jimrif »

I was having similar issues and installing the "php-process" package helped a lot.
jogo
Posts: 46
Joined: Thu Aug 03, 2017 3:00 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by jogo »

I have configured a ZoneMinder server based on Fedora 36, which pulls a couple of newer packages compared to my old CentOS 7 system. So far, everything seems to work fine and I do not have any display problems
binarybits
Posts: 2
Joined: Mon Jun 13, 2022 12:36 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by binarybits »

On my CentOS-7 based install, with PHP-5.4.16 the PHP function sem_acquire supports only 1 parameter but 2 are given so call fails BUT something hides the error log about it.

I edited /usr/share/zoneminder/www/ajax/stream.php on line 22, patch to version from zoneminder-1.36.17

Code: Select all

--- /usr/share/zoneminder/www/ajax/stream.php.orig      2022-06-14 01:15:53.748000000 +0930
+++ /usr/share/zoneminder/www/ajax/stream.php   2022-06-14 01:15:57.575000000 +0930
@@ -19,7 +19,7 @@
 $have_semaphore = false;

 while ($semaphore_tries) {
-  $have_semaphore = sem_acquire($semaphore, 1);
+  $have_semaphore = sem_acquire($semaphore);
   if ($have_semaphore !== false) break;
   ZM\Debug('Failed to get semaphore, trying again');
   usleep(100000);
And that fixes it for me.

WARNING!!! The 2nd (removed) parameter was telling it not to block indefinitely, so I am not sure what deadlocks or other "interesting" features this might cause. It's my 1st day trialing zoneminder and if I break something I might not even know how it was supposed to be. Use at your own risk.

I suppose a better fix would be to upgrade PHP to a version that support 2 parameter version of sem_acquire(), but upgrading PHP ... well... maybe.
binarybits
Posts: 2
Joined: Mon Jun 13, 2022 12:36 pm

Re: after upgrading to 1.36.17, blank video in montage, and web_php "Unable to get semaphore." in log

Post by binarybits »

Upgrading PHP from 5.4.16 to 7.2.34 also fixed this problem for me.

Steps I used to upgrade PHP on CentOS-7 here https://www.ezeelogin.com/kb/article/ho ... s-282.html
Post Reply