[SOLVED] "webcam" utility works a while, then outputs same image over and over
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
"webcam" utility works a while, then outputs same image over and over
Using webcam component of XawTV package as supplied with Ubuntu 10.10. My implementation seems pretty basic, just needs to snap every 5 seconds and ftp to web site. It actually works just fine, but only for an hour or so. Then process continues to run, but image does not update. Kill & restart webcam and it works fine again, until it doesn't. Video stream in XawTV window is fine throughout, so I don't think there's a hardware problem.
Try testing the webcam in cheese--choose "burst" to have it take multiple photos about every 5 seconds. I think it's included in Ubuntu by default, but, if it isn't, it's in the repos.
You might also use GKrellM to monitor memory usage during testing. It's also in the repos.
If the webcam stays valid in cheese for, say, two hours, that will indicated that there's something happening with XawTV's webcam component.
Last edited by frankbell; 01-22-2011 at 09:15 PM.
Reason: clarity
Thanks, all good troubleshooting ideas but still experiencing same problem.
Have more info now, which I believe points to the FTP transfer process as the culprit. As time passes, "lsof | grep ftp" reveals an ever-increasing number of open files in something called (CLOSE_WAIT) state. I've tried to research more but am waay over my head here. Can anyone point me in the right direction?
Thanks frankbell for the prompt reply. Uploads are quite rapid, and I have tried intervals of varying length. At a minute it runs about a day, while at 40 seconds it goes overnight. The correlation between the interval and total time to failure was what got me looking at open files / unreleased sockets (if that is the appropriate terminology).
I'm not a video/webcam guru by any means, but I have a diagnostic thought.
Try installing GKrellM (it's in the Ubuntu repos). You can use it to monitor CPU and disk usage (and lots of other stuff); I would set it to show the swap file monitor in addition to the default monitors. I would keep an especial eye on swappage--I don't have a good reason, it's just a gut feeling that swap file usage may have something to do with this.
That the system works fine for a while and then gradually grinds to a stop leads me to think that the problem is something that accumulates over time, rather than one single event.
GKrellM tells me more while using fewer RAMS than that Gnome system monitor thingee.
Marked as "solved" but it really isn't. I've implemented a kludgey workaround which will suffice until I get something else working (probably going to be "motion" based http when I'm done).
All my research indicates that CLOSE_WAIT failures are to be blamed on application bugs. Somewhere in the code that pushes images up to the ftp server, webcam (which is a utility that is part of the XAWTV package) apparently fails to close its connections until the main process is killed. The file descriptors to each open socket accumulate, one per transfer, until the system's max limit is reached and the process chokes.
What I did to get around it is:
Use Upstart to make webcam start on system startup
Enter a cron job in root's crontab to restart the upstart job every 30 minutes, which flushes the tied-up ports
Not a solution I'm proud of, but it will do for now.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.