-
Notifications
You must be signed in to change notification settings - Fork 160
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
Mediapipe 0.8.6 segfaults after running for a couple minutes #127
Comments
How about 0b0321e? That's the commit I have right before adding on-demand processing. Does it segfault? |
@DrDynamic's reply suggests problem with mediapipe Could you both try updating Mediapipe to 0.8.6? |
I'm already on 0.8.6 🤔
|
@darthmooguy , could you downgrade to 0.8.5 to see if it helps? You can always try compiling mediapipe from source, but that sounds extremely painful. |
I've tried 0b0321e also, and I still get segfaults. However, I get them pretty much everytime i'm doing something CPU intensive (opening Android Studio, compiling an Android project in Android Studio...), and with 0b0321e it crashed both the fake.py and Zoom the first time I opened Zoom! I'll try later today with mediapipe 0.8.5. |
I am running now with mediapipe 0.8.5 which seems notably slower but no crashes so far on master... |
@fangfufu With mediapipe 0.8.5 it seems stable on master! I was able to be in a zoom call for 15 minutes without segfaulting, and while compiling! However, I get 15 fps and it sometimes drops to 7 fps (seems random), which is pretty slow, altough not a deal breaker. |
Oh! This is very interesting! |
@fangfufu Yesterday I tried compiling mediapipe myself but the Segmentation fault kept coming. Now I'm running mediapipe 0.8.5 a Segmentation fault with another stacktrace:
|
I have the same problem. Running it without the on-demand option helps a bit. But it still can happen. I'm using the v4l2loopback webcam and after crashing, I have to completely unload the module and load it again. Otherwise the application automatically crashes with an os error |
@majuwa, @DrDynamic ,what OS are you on? @majuwa, have you tried Akvcam? @DrDynamic, could you try Python 3.7 please? |
I'm working around occasional crashes with "if crash, restart" with Python 3.8 and mediapipe 0.8.5 - fortunately, in my case, it's only the script that segfaults:
(will try mp 0.8.6) |
@Piskvor , I really dislike workarounds, if somebody can figure out why it crashes on their particular setups, it would be great. |
I'm using Ubuntu 21.04. I haven't tried Akvcam so far. I will try it |
I'm also on Ubuntu 21.04. And using Python 3.9.5. |
I am using Python 3.8.10 - are you getting troubles with 3.9.5? |
@DrDynamic It works for me on Python 3.9.5 and mediapipe 0.8.5 (on Fedora 33) 🤔 If you want to try with python3.7, you could do so with miniconda. |
Running Ubuntu 20.04.2 LTS with python 3.8.10 and mediapipe 0.8.6 and I can confirm that while running it through discord the other night that it was crashing out every 15-20 minutes (sometimes longer, sometimes shorter) though sometimes was lasting a while longer. I was just using background replacement (no foreground) and using the no-ondemand option (haven't actually been able to get discord to pick up the camera without disabling ondemand. Rolling back to mediapipe 0.8.5 seems at least as stable if not more (not crashed yet after about 30 mins) Looking at mediapipes github it could be related to this google-ai-edge/mediapipe#2250 but no news on investigating it yet. |
Right I can confirm that I experience mediapipe 0.8.6 segfaulting. |
I'm currently seeing the same behavior. I tried to put under load the machine (10+) and the issue happens much more frequently, in just under a minute you can see it.
Let me know if more details or some specific actions can help. |
Updated mediapipe to 0.8.6.2. It seems to work fine. Please comment if it doesn't work fine. |
I just had this issue with 0.8.6.2.
For me replicating the issue is quite easy: start the app and have the machine installing some gentoo packages :) |
@cova-fe , could you try 0.8.5 to see if the problem disappears? |
Sure, just few minutes. |
Interesting, I was able to recreate the issue also with 0.8.5, even though it seems that the needed load was higher.
I guess I can investigate more deeply on where exactly the SIGSEGV happens. |
Yes, please do investigate. Also, it seems turning off on-demand mode helps. |
I was able to get a bt, not sure how useful could it be:
|
The SIGSEGV happens inside compose_frame(), when classifier is called on (frame).
|
Wow, how did you figure that out? Does it help if you get rid off the Failing that, it might just be the problem with Mediapipe. |
I used an horrible approach: sprinkled the code with debug print with the line number. I was able to bisect the single line in this way. It helped me that I can reproduce the crash in a minute or two. Let me try to remove the line you mentioned. |
You might also want to remove |
So, last findings: removing the line |
Those flags were there to improve performance, as per https://google.github.io/mediapipe/solutions/selfie_segmentation.html |
Removing ``frame.flags.writeable = False`` as per: #127 (comment) Those flags were there to improve performance, as per: https://google.github.io/mediapipe/solutions/selfie_segmentation.html
I removed those lines for now. Hopefully it works better now. |
So, commenting out the frame.flags.writeable = true does not seem to help, as I was able to cause a crash. Now I'm running the app with the flag set to True, let's see if I can get crashes (so far none). If it is a timing issue, it could be tricky to pin down. |
Unfortunately it seems that it happens again, albeit less frequently. Could it be something of interest for mediapipe developers? |
@cova-fe , there was a ticket raised in Mediapipe's repository already, have a look at #127 (comment). |
I just upgraded to Debian Bullseye. I get crashes even at 0.8.6.2. So I pinned MediaPipe version back to 0.8.5. |
|
Removing ``frame.flags.writeable = False`` as per: fangfufu/Linux-Fake-Background-Webcam#127 (comment) Those flags were there to improve performance, as per: https://google.github.io/mediapipe/solutions/selfie_segmentation.html
While running, I get 20-30 fps depending on the other workload of my CPU, which is pretty good! However, like in #105, I get segfaults after 4-5 minutes.
Here is my setup:
Fedora 33
Kernel 5.12.12-200.fc33.x86_64
CPU Intel i7-6700HQ (8) @ 3.500GHz
RAM 32GB
Latest commit of master branch of this repo (23ffc61)
To date, I have tried with
v4l2loopback-dkms
version 0.15.2 from this copr, and with the latest commit of the main branch of the v4l2loopback repo.On the multithreaded branch I get better FPS (45), but it also segfaults.
Here is the output of the command during a Zoom call:
It also segfaults using the
--no-ondemand
param.The text was updated successfully, but these errors were encountered: