-
Notifications
You must be signed in to change notification settings - Fork 904
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
Camera stops working several times a day #1730
Comments
I have my RPi 3 B Running motionEyeOS dev20181126 / MotionEye 0.39.3 and USB Logitech C920 to monitor my snake. The camera will stop working several times a day to where it shows the broken camera image but the UI still loads. I can get it to restart by rebooting or by turning off/on the video source and applying but it's basically useless at this point is I have to do this as the point is to catch images and videos of my snake who often comes out when nobody is around. I was previously using this device to run OctoPrint to control and monitor my 3D printer, and it would run for days, even months without issue. I started off saving motion images and videos to a network share, but have changed it to save local - no effect, I was getting some errors related to power in my logs so I ordered an official RPi 2.5a power source - the errors in the logs stopped but the camera still stops working. I disabled the "Connectivity check" option - no effect. I have read the other similar posts but nothing that has been suggested there has worked. |
So tonight I replaced the older 4GB microSD card that I was using with a newer high speed Samsung 32GB microSD. I did a whole new image and we will see how this goes. |
fwiw take a look here, I reported a similar issue back in July: github.com//issues/1582 |
@IAmOrion - Thanks I did check that. One big difference I noticed is that I do not have to unplug the Pi, and my web GUI is still working, I have a open SSH session that does not end, and I can turn the video device off/on then apply and it starts working again. |
OK I think I may have made some progress. With the new microSD card I was super hopeful as it went quite a bit longer than it had been. Then this morning it crashed again. I currently have it saving locally and not to SMB. I also changed the still images to just save every 10 seconds, not on motion detection. One thing I noticed when I found it stopped is that the last image taken was at 09:37:10 local time. Here are the log entries from that time: messages.log:
motion.log (last written to at 09:38)
motioneye.log
So I have it emailing me when it detects motion, and it seems that either that, or the motion detection is causing an issue. I am disabling the notification now and see how that goes. I do not believe it is a network issue, as per my above reply to @IAmOrion I have an open SSH session and constant connection monitor running on my desktop and those are not erroring out. |
I have the same problem as thejoester. [0:motion] [ERR] [ALL] main: Thread 1 - Watchdog timeout, trying to do a graceful restart I got this problem on my 2 rescent upgraded Pi's (refresh installed latest image (20181210) and restored my old config) The webinterfaces is still running and a simple config change and Save button restarts the thread with again a connected camera image. |
So two weeks later and since disabling the email notification I am not having any issues. Just to fully test this I am going to enable them. |
I don't use email notification. I do use motion detection (with a fixed grid/raster). |
The last two weeks I have had motion detection enabled for movies, but not for images and have had no issues. |
I can confirm that I am having the same issue as listed here. Pi2 with RPi Cam module. Did a fresh install on the latest release (previously had a July dev release which gave me no issues) and have both restored a config and done a fresh setup and I'm having the same issues. It will run for a few hours, capture and upload to my Google Drive (capture on motion) then lose connection to the camera. A config change or restart brings the camera back. |
It seems like more and more people have this problem running Raspberry Pi camera. Connection to the camera is lost every time motion is detected and recordings are made. Calin, did you also experience this problem on your devellopment system ? I fully disabled motion recording for now and just use the camera as fast network camera option which still works. If bug can not be found I ll revert back to the working july dev release. Regards. |
Just to confirm, with the exact same hardware and with a restoration of my config, I have rolled back to the June release and everything is working perfectly and as expected. Motion doesn't crash, I don't lose picture and motioned events are successfully uploaded to my Google Drive. |
motion version in MotionEye is old (4.1), current version is 4.2.1, since 4.1 a lot of bug fixes & enhancements were made. It there any progress or event effort made in this "freeze problem when saving pic/movie on motion alert" ? Problem occurs since dev20181126 (reported 3 december 2018). Now almost a month later : not even a response on the issue. Is this project dead ? |
@ccrisan It's a good point - can you please acknowledge as an issue and we can them await a fix? |
just FYI: I installed yesterday a brand new Raspbian Stretch onto a USB stick which is booted by a raspberry Pi 3B+ running the latest motion 4.2.1 and the latest MotionEye. Until now everything OK, motion is detected and recorded without interruptions or losing connection to the connected raspberry pi cam. |
Can you guys please list step by step instructions on how to reproduce the problem? Please include detailed information on your system too, things like how many cameras, what else is attached to the RPi, configuration of your motionEyeOS (motion detection, media storage location, ...). This may very well be a motion software bug. Try isolating the problem by running motion without motionEye. See https://github.com/ccrisan/motioneyeos/wiki/Report-Motion-Issue |
Guys, the problem of camera connection loss is something very general and may have many possible causes. Few users care to report the working and non-working versions they've tested. Even fewer of them tried to isolate the problem, as @jasaw indicated. This makes it almost impossible for us to get to the root cause of this problem (or problems). I personally haven't experienced any similar problems with my setup (10 RPi1 FNCs + one Odroid XU4 hub). I have seen a fair amount of users complaining about this issue happening with mid 2018 versions. Some of them reported that recent prereleases (end of 2018) fixed their problems. I will try to make some time to add Motion 4.2 support to motionEye but I have my doubts that it would fix these problems for everyone. |
These issues were reported since beginning december 2018. (Including soft & hardware (Pi) versions, setup, attached devices, motion settings, recording or not to movie/pictures, log files, ... Jigsaw's and your reponse now is exact 45 days after initial problem reporting began. We've cleary stated that it is a recording movie problem, since the video stream does not crash when no movies are recorded by motion. So problem is :
Since another user stated problem also occured when recording his movies to dropbox/... option 3 is not likly. I have tried different setup's and gave feedback here on the issue tracker. Without response. My last effort was converting 1 of my 2 MotionEyeOS Pi's to a dedicated Raspbian fresh install. I stated indeed that maybe upgrading motion (4.1.1 to 4.2.x) could maybe fix the problem. Every day new issue topics appear on the issue tracker regarding this problem. 3 days ago this interesting topic appeared: 22 hours ago topic starter "gui59169" gave the correct and final answer/solution:
Indeed not using "H.264/OMX (mp4)", but for ex: "H.264 (mp4)" seems to FIX the problem. The hardware enabled movie encoding (using GPU power of the Pi) seems to crash the threads. Problem is located then in "ffmpeg"encoder I presume. Difference in version of ffmpeg : MotionEyeOS: Raspbian installed ffmpeg: Besides ffmpeg version difference I also notice a difference in presence of possible parameter : --enable-omx --enable-omx-rpi (motionEyeOS) Raspbian uses an older version 3.2.10-1.... while motionEyeOS used 3.4.4 ? Thanks again to "gui59169" for pointing out the real problem (option 2) . :-) As for ffmpeg solution :
|
@bertdebondt this is a really interesting finding. I never thought the OMX hardware acceleration could cause these stability issues, but now, if I think about it, it makes sense. The last Motion update in motionEyeOS was more than 1 year ago so that couldn't really be the problem. FFmpeg on the other hand could be indeed causing the issues. @jasaw do you have any ideas how we could further debug/investigate problems that have their origin in FFmpeg RPi OMX code and result in Motion blocking or crashing? |
cudo's to gui59169 |
@bertdebondt are you sure the Raspbian version of FFmpeg comes with OMX acceleration? |
yes, version included in latest Raspbian Strech : I tried sudo apt-get install ffmpeg, but this gave answer that latest version was already installed. (i think) |
@bertdebondt could you please post the |
ffmpeg version changes in buildroot:
Version 3.3.5 is good. I've been using this on all my cameras. Raspbian uses ffmpeg version 3.2.10. This version works fine as reported by users. I'm not aware of any changes to the OMX code in ffmpeg in those versions, so unlikely to be a bug in ffmpeg's OMX code. Another possible cause is the GPU firmware, from rpi-firmware package. I know for a fact that rpi-firmware was broken since 1 year ago, and was only fixed in the Oct 2018 version, but we are still on the broken version. The bug in the GPU firmware, when triggered, causes the entire Pi to lock up, requiring a power cycle to recover. Several programs can trigger this bug, but ffmpeg was fine when I tested.
It could still be the way motion uses ffmpeg API that causes the problem. Maybe h264_omx vs libx264 returns slightly different data and motion thread gets a segfault. It could also be the data from both interfaces are aligned slightly differently in memory. This is why I suggested to run motion alone, follow the instructions on https://github.com/ccrisan/motioneyeos/wiki/Report-Motion-Issue. Run motion in the foreground, see what happens. I also can't reproduce the problem at my end, so it would be good if you guys could provide more information on how to reproduce it. From what I've read above, saving movies to local disk using OMX encoder at any resolution should trigger the bug? Does it happen every single time or is it intermittent? As for turning on OMX on Raspbian, there are a few things that needs to be done to enable OMX.
|
codec encoder h264_omx is enabled: ffmpeg version 3.2.10-1
built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516 configuration: --prefix=/usr --extra-version='1 |
Not sure what you mean, but:
Maybe we should downgrade ffmpeg to
Are you sure about that? I always update |
@bertdebondt your ffmpeg indeed has OMX h264 acceleration support, but as far as I know, Motion won't use it on Rasbpian, unless patched; @jasaw may know more about this. |
Our current version of rpi-firmware (5b49caa) is from Sep 25, 2018, which still has the bug. Bug was only fixed on Oct 10, 2018. Anyway, this bug does not affect ffmpeg, so we can rule this out.
This is exactly what I'm thinking. As for enabling h264_omx on Raspbian, see this: motioneye-project/motioneye#930 (comment) |
So my ffmpeg version was already OMX h264 accelerated. |
@bertdebondt that's a bummer. So ffmpeg and rpi-firmware are not to blame here. Guys, any more ideas? |
What was the reason for not upgrading to the latest version of Motion? It looks like MotionEye uses an old version of Motion, surely that's the next obvious step - to upgrade to the latest version? |
@davisstu motionEye doesn't work well with Motion 4.2. |
@ccrisan @bertdebondt I managed to reproduce the problem at my end thanks to another user who is experiencing the same problem and documented steps to trigger the bug. The issue comes from either rpi-firmware or rpi-userland. This bug only shows up when the GPU is unable to cope with the data and motion starts reporting timeout on the camera thread (thread-1 in our case) and starts killing the thread. The logs below is what motion reports when we encounter this problem. Users who encountered this issue have loaded up the GPU either by pushing high resolution, or by pushing multiple camera streams to the GPU to encode.
I rolled the rpi-firmware and rpi-userland back to the version used in 20180627, and this problem disappeared. I don't know what change triggered this bug in the rpi-firmware/userland. raspberrypi/firmware#1051 (comment) might have something to do with it? What can we do to address this issue? I don't know yet... |
@jasaw that's a very good finding. For now, I'll downgrade the rpi-firmware and userland and hope they work well with the latest kernel & everything. In the meantime, since the issue you referenced in rpi-firmware seems to have been fixed for everyone, I believe it's not our issue. Nevertheless, it may be worth reporting our problem to them. Do you think Motion-4.2 has a chance to fix/workaround this problem? |
@ccrisan After a bit more testing, I'm starting to think this is a motion software problem. When motion prints "Buffered packet" and EAGAIN, it is still recording the video just fine. After 30 seconds of EAGAIN messages, motion decided that watchdog has timed out and kills the camera thread even though the camera thread is still doing its job. I'm marking this as a motion bug for now. I've reported this to motion project too: Motion-Project/motion#888 I don't know what the side effects are for using old rpi-firmware/userland with new kernel, but we should still roll back as a temporary workaround until we can fix it in motion. Regarding motion 4.2, I highly doubt that 4.2 is going to fix this problem. |
@ccrisan I'm pretty sure what we have is this bug: raspberrypi/firmware#1087 |
@jasaw I will happily apply the patch myself but I'm a bit lost here. The rpi-firmware bug 1087 you mention, is that the bug? So you're not suspecting Motion anymore? A new nightly build will be soon available with Again, if you think or know that the patch solves this problem entirely, even for recent |
(Pi firmware developer here) FFmpeg appears to have always had an issue in how it handles OMX components. In the firmware release of 9th July we changed the video_encode component to use a hardware block in the input stage as it gives a significant performance advantage. This tweaks the timing slightly, and FFmpeg's flawed output buffer handling starts failing to collect all the buffers in a frame. The codec output FIFO (2MB) isn't being drained correctly, and eventually the codec stalls due to having no space remaining. The diff to FFmpeg corrects the behaviour so that it collects all the data in each frame, and therefore the codec won't stall. |
@6by9 Thank you for the detailed explanation. Your ffmpeg @ccrisan The bug appears to be in ffmpeg and not motion software. I've created a PR that adds this |
Guys, that's great news. I'll make sure to prepare the next nightly build according to all these, but unfortunately my CI machine just crashed and I need to see what's going on. I'll keep you posted, here. |
dev20190118 should contain the ffmpeg patch added by @jasaw. Please test it and let us know if the problem is fixed. |
Thank you all. I installed the new dev20190118 build at 1:30 UTC (8:30AM EST). Will report back in 24h to provide an update on the status. Glad to provide any additional info you may like to see. |
I also installed it and it looks like the problem is fixed. |
Closed via b80aedf. |
Fixed for me too! Thank you all. |
If I set up the new nightly build, can subsequent versions be updated ok? (I'm assuming the warning about not updating is only if you're coming from 20180627 or earlier?) |
Worst case scenario would be to backup your config file, fresh install and reapply config. I tend to do this on major releases anyway, as the inbuilt upgrade tends to be unreliable. |
@IAmOrion yes, you will be able to upgrade seamlessly afterwards. Nevertheless I recommend using the latest pre-release (instead of nightly). No significant difference, just the fact that it's a proper release with version & everything. |
The problem with that, is in my usage case, my Pi's are all remote and a royal pain the behind to get to.
Great, thanks. I did actually mean the pre-release (20190119) and not nightly, but thanks for the info. I'm hoping this will also fix my issues from here #1582 |
I'm seeing this problem on a Raspberry Pi 3 Model B Plus Rev 1.3, motionEye Version | 0.42.1, Motion Version | 4.2.2+gitUNKNOWN, OS Version | motionEyeOS 20200606 Should I open a new issue or ask that this one be re-opened? |
Open a new on if 20190911, 20200203, or dev20201026 do not resolve it. There are many known issues with 20200606. |
Preliminary Docs
I confirm that I have read the CONTRIBUTING guide before opening this issue.
Yes
I confirm that I have read the FAQ before opening this issue.
Yes
motionEyeOS Version
motionEye Version | 0.39.3
Motion Version | 4.1.1
OS Version | motionEyeOS dev20181126
Board Model
I am using the following board/model: Raspberry Pi 3 B
Camera
I am using the following type of camera: USB Camera
My camera model is: Logitech C920
Network Connection
My motionEyeOS unit is connected to the network via: WiFi
Peripherals
I am using the following peripherals that I consider relevant to this issue: Only USB Camera
Log Files
I consider the following log files relevant to this issue:
boot.log
dmesg.log
messages.log
motion.log
motioneye.log
The text was updated successfully, but these errors were encountered: