[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.
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.
"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.
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.