New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(FreeBSD)(CLANG) Sendfile7 support is broken #3505
Comments
Um.. so I think we can get away with just casting ... ssize_t and off_t are basically the same. So how about this?
|
^ My idea was to change argument, but if you want to keep it, casting works as well. I'll apply yours variant then. Thank you! |
The issue is that we were abusing the stack variable size. Which really.... we shouldn't do. So I think this looks better. Does it compile and work there? If so I'll merge it. |
The code compiles, but something is broken in zms. Monitor live view is constantly refreshes. The logs is filled with
I'm building with DHAVE_SENDFILE=0 The last version that works is v1.36.12. Probably, I should try bisect or revert some obvious places to see if it helps. |
Probably, it's not zms, but zmc.
It looks like zmc provides broken video to all subsystems.
Now I have the following suspicious places:
|
Semaphore issue was simple enough - for semaphore support I need php74-sysvsem PHP extension. Stream is working now.
and
for every monitor in Record state (with or without analysis enabled) "Locked packets" are filling logs very fast. Monitors are ffmpeg 5MP with 6 FPS 6000 VBR in passthrough mode. I see, the severity of such messages was bumped recently from Debug to Warning. Who is not keeping up here? Analysis issue is the most troublesome - it forces zmc to reload every minute. I think this is not FreeBSD specific problem. Also, content policy should be relaxed to unblock eval() in js if it's used.
solves script error. The problem with http:// link is tricky. I didn't find exact place. I see the following in the logs:
So, it detects correct URL with https:// but after that tried to use http:// |
My experience with 5MP cams is that we cannot decode, and do motion detection on them fast enough. Yes you do need semaphore support. Can we please leave this discussion to the issue at hand? Being sendfile implementation. What is the status of that? Is it working with SENDFILE=1? |
I agree, should I create separate issues for the problems discovered? Issues with record only monitors is rather serious. As for sendfile implementation:
|
I think sendfile on FreeBSD can only work with sockets. When I built it with sendfile support, I wasn't able to watch recorded events with the following error in logs:
ERRORS section of the manual lists
Here |
@abishai what is the state of this ? I there something I can merge to master? |
@connortechnology With your patch, ZM compiles and works with SENDFILE=0. According @badrpc it looks like SENDFILE must be 0 on FreeBSD. As for 'supplemental' issues mentioned in #3505 (comment) record one is too serious and blocks my migration from 1.36.12 But maybe it was fixed in latest versions of ZM. Probably, I'm the only user of ZM on FreeBSD, at least nobody complains that we have outdated 1.36.12 in port tree. I think, we can formally close this issue and hope that latest version of ZM operates better than 1.36.19. |
@abishai, I'm installed 1.36.12 today! My patch is:
Let's try together update port! |
Is 1.36.32 has deprecated warnings fixed? Can you check that Record mode works as well?
|
I would expect those to either be fixed, or the issue is outside ZM. php8.1 deprecation warnings are simply turned off in 1.36.32. |
So this patch compiles fine here.... I'd be happy to merge it... |
I compiled 1.36.32 with this patch and I don't see any issues so far, save for icons not visible in Web UI. Recordings and montage work fine, and no errors in the log. I sent an email to @abishai with the ports tree patch |
@hjf can you watch recorded events? |
yes when watching as MP4. it acts weird as MJPEG, but i'm not sure if it's my setup. |
@connortechnology May I ask you another offtopic question here ? Some of locales in lang looks suspicious. For example, en_gb.php contains LC_TIME=en_GB.utf8 . I think this is incorrect, it should be UTF-8. |
nm, it's fixed already. |
@hjf Received the patch, will try it. Thanks! |
I don't see them anymore.
I'm use Modect with Camera Passthrough. After I install 1.36.12 and configure 3 cams I got #3414, then added ram 16GB+swap 16GB, but OOM was almost after every alarm. Then it disappeared and I don't know what helped. It work fine for 3 days with a lot of alarms even with 4GB of ram without use of swap.
Analysis FPS 2, FPS from cam 10, video stream from cams 2048x1536 h264. Top look like this most time:
|
Analysys FPS (and other ZM FPS settings) are very dangerous. I think they should be unset... |
Is ajax request works for you in monitor view ? (Request that loads monitor alarm state and fps). It throws HTTP=500, something is wrong with semaphores again, however I have semaphore php extensions. |
I have had OOM but I think they are related to my server not being able to compress h.264 fast enough. but I tried to revert back to JPEG and the MJPEG recordings don't play. there is a segfault in logs. |
Well, looks like 1.36.12 is the last one that works under FreeBSD. Any attempt to write stream produces zmc crash. While monitor in detect mode and detection not triggered everything looks OK. The fasted way to test is just put monitor in record mode. I've tried to lower FPS and resolution, so it's not 'decoding not keeping up' and single zmc instance produces 0.3 load (= less than 1 core)
signal 11 is always comes after 'locked packed' warning. Probably, memory corruption after zmc memory exhausted. |
Recommendations got this #3414.
Montage preview? Or what?
Where do you get this log? What file name? Oh, from menu Log:
|
When you click on monitor name ?view=watch |
I see video, but apache spam php errors in
Ofc process with owner
|
Probably some temp directory or config is not set. On another way, php issues are not so serious. But zmc crash is. All I know version 1.36.12 works, 1.36.32 (and as I know for sure - 1.36.19) has zmc issue. So we can't update the port. |
Every 10 minutes:
1.36.32 buggy. |
In the directions linked to, some additions/comments: You missed the step where you actually start fcgiwrap I have my system up and running with 1.36.32, It has some serious issues. First off, it seems to be trying to save event data to /var/db/zoneminder/events but that dir didn't get created/ownership assigned. |
@connortechnology Is port runs for you or you need some help? I believe, the best way to be sure everything is OK is try 1.36.12 first. It runs smoothly. |
Have it installed and running, but it is crashing. Working on it. |
How can I get the debug symbols from ports ? |
I have solved the crash I was experiencing. Something I had fixed in master. I will release 1.36.33 this week with the fix. |
|
For me, situation doesn't improve with the patch. Monitors in record and mocord mode are crashing. Modect mode works outside of alarm state. @VVD Is situation improved for you? Maybe I connected dots in wrong way with the port.
|
… of the time, don't dereference it. When falling back to read/write, just read in chunks of 4096, because I don't know how to make llvm use c99 dynamic arrays. Check for HAVE_SENDFILE. Fixes #3505
I can now view jpeg saved events after applying 8300a7b . What I am seeing now is the that opening a new event is taking forever. .2 seconds to do the event insert into the db. So the capture queues fill up. Also, decoding is not keeping up. I don't know why freebsd is so slow for decoding. It can't keep up with a 1080p stream in this vm. Similar Ubuntu vm's have no trouble. |
I have 779ae50 applied only. The decoding is not keeping up since 1.32.16. Currently, my installation contains 12 5MP cameras on 4fps and they consume 4-5 cores. The same warnings exist in 1.36.12 zm_packetqueue.cpp but logs are silent. I'll try to enable debug logs then to see timings. |
zmc.log Maybe you know better where to look. ZM writes quite a lot :) |
It's not "FreeBSD slow". On both OSes ZM use ffmpeg. 3M (2048x1536) cam 10 fps h264 - decoding and analyzing "eat" ~20-25% of 1 core of Core i7 920@3.1GHz in VirtualBox vm. |
I can't apply patch:
And it's after return
Too much changes from 1.36.32. |
Returned back on 1.36.12. |
I've applied https://github.com/ZoneMinder/zoneminder/commit/779ae5051e43629189b7f6780978676a7c6a21ca.patch to 1.36.32 without any issues. |
Oh. |
I have pushed my latest fixes to release-1.36 branch. Compiles and runs perfectly for me now. |
Your patches for port multimedia/zoneminder or for zoneminder itself? |
ZoneMinder itself. |
Hello, I'd like to return to port upgrade. |
1.36.33 shows signs of flawless working ^^ I see no packet locked logs or any other warnings. Recording and detection works as well. Huge thanks to @connortechnology and everyone who helped to test ZM. I'll leave updated ZM to work for a day to see if I find something. |
Just for information: updated to 1.36.33 and it work fine now. |
@abishai I think we can close this now, right? Also, I've been looking at an openbsd port. Which got me thinking the freebsd port stuff should be included here under the distros directory maybe. What do you think? |
@connortechnology Yes, I suppose this one can be closed. Probably, the only candidate is rc.d script https://github.com/freebsd/freebsd-ports/blob/main/multimedia/zoneminder/files/zoneminder.in but I doubt it worth a dedicated directory. |
So... I just think keeping everything in one spot is the way to go, but on the other hand, I've thought about stripping out the distro dir into it's own repos, which is certainly the debian way to do things. So I don't know. What I do think is that there should be both a stable port (1.36) and a master port. |
I try to build ZM 1.36.19 and after recent changes in https://github.com/ZoneMinder/zoneminder/blob/1.36.19/src/zm_sendfile.h it doesn't compile
I can revert the offending argument to off_t back, but is it a viable solution?
The text was updated successfully, but these errors were encountered: