LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
Search this Thread
Old 01-21-2011, 08:16 PM   #1
feldmrob
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Rep: Reputation: 0
"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.

Last edited by feldmrob; 01-21-2011 at 08:36 PM.
 
Old 01-22-2011, 11:21 AM   #2
no2498
Member
 
Registered: Jan 2010
Posts: 120

Rep: Reputation: 23
can only think of a few things
the screen saver trying to come on
or the hard drive spinning down
or you open a different cam program
 
Old 01-22-2011, 09:15 PM   #3
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,715

Rep: Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458
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
 
Old 01-25-2011, 07:36 PM   #4
feldmrob
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Apparently an FTP 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?
 
Old 01-25-2011, 09:27 PM   #5
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,715

Rep: Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458
How long does it take for one of the images to upload?

If it's longer than five seconds, that could lead to transfers piling up on one another.

Try changing the upload interval to a longer time, say a couple of minutes, and testing.
 
Old 01-25-2011, 10:00 PM   #6
feldmrob
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks

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).
 
Old 01-26-2011, 11:02 AM   #7
no2498
Member
 
Registered: Jan 2010
Posts: 120

Rep: Reputation: 23
1 more thing to look at is xawtv in your home folder
 
Old 01-26-2011, 07:27 PM   #8
feldmrob
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Any ideas on this as an ftp (CLOSE_WAIT) problem?
 
Old 01-26-2011, 09:26 PM   #9
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,715

Rep: Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458
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.
 
Old 01-30-2011, 10:24 AM   #10
feldmrob
LQ Newbie
 
Registered: Dec 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Not really solved

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:
  1. Use Upstart to make webcam start on system startup
  2. 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.
 
Old 01-30-2011, 09:11 PM   #11
frankbell
Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Mageia, Mint
Posts: 7,715

Rep: Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458Reputation: 1458
Quote:
Originally Posted by feldmrob View Post
Not a solution I'm proud of, but it will do for now.
You made a workaround that works.

Personally, I think that's something to be proud of. You no longer have an emergency.

You are "up and running pending future enhancements."

I think that's cool.
 
  


Reply

Tags
webcam


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
evdev/xorg help? USB mouse/kbd: 2.6.24="just works">2.6.25="unplug/replug to work". GrapefruiTgirl Linux - Hardware 4 12-13-2012 02:23 PM
How do i create a calendar/remind program that outputs "xmessage" or similar?? kline Programming 3 08-11-2010 05:20 PM
ping outputs TX to "loopback" instead of "eth1" Jojo1 Linux - Networking 0 04-12-2006 05:10 AM
"multiboot utility" and "dell utility partition" on dell i5150 xround Linux - Laptop and Netbook 5 04-21-2005 09:19 AM
C program that takes input "FName|LName" and outputs to std out its_godzilla Programming 2 01-18-2005 10:26 PM


All times are GMT -5. The time now is 05:13 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration