Another instance of Camera Monitor is already running

Bug #599185 reported by naesk
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
cameramonitor (Debian)
Fix Released
Unknown
cameramonitor (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: cameramonitor

Ubuntu Lucid 10.04
SAA7134 TV Card

On every start up of desktop after login, an error notification is displayed "Another instance of Camera Monitor is already running!"
There is only one process of CameraMonitor running in the Start Up Applications config.

Revision history for this message
ybaruss (yabruss) wrote :

May be related with BUG ##575000

Revision history for this message
ybaruss (yabruss) wrote :

May be related with BUG ##224821

Changed in cameramonitor (Ubuntu):
status: New → Confirmed
Revision history for this message
ybaruss (yabruss) wrote :

May be related with Bug #575000
May be related with Bug #224821

Revision history for this message
ybaruss (yabruss) wrote :

Hello,

Can you please say if your webcam is on usb port ?
Can you release command: "sudo lsusb" and prompt the dump ?

Changed in cameramonitor (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Steffen (steffen-stfm) wrote : Re: [Bug 599185] Re: Another instance of Camera Monitor is already running

Hello!

My camera is not on an USB Port it is buildt in. My Notebook is an Acer
6530.

But here is the lsusb output:

Bus 006 Device 002: ID 147e:1000 Upek
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 003: ID 05e3:1205 Genesys Logic, Inc. Afilias Optical
Mouse H3003
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0bda:0158 Realtek Semiconductor Corp. Mass
Storage Device
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 064e:a103 Suyin Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Thanks for your work to solve the problem.

Kind regards,

Steffen

Am Samstag, den 02.10.2010, 09:39 +0000 schrieb ybaruss:
> Hello,
>
> Can you please say if your webcam is on usb port ?
> Can you release command: "sudo lsusb" and prompt the dump ?
>
> ** Changed in: cameramonitor (Ubuntu)
> Status: Confirmed => Incomplete
>

Revision history for this message
ybaruss (yabruss) wrote :

Steffen,
Thanks for your quick answer.
Yes the webcam of your Acer 6530 is "built in" but it is actually connected to the USB internaly.

Bus 001 Device 002: ID 064e:a103 Suyin Corp.
See there: http://www.suyin-europe.com/index.php?Itemid=151

There is a bunch of bug raised on 10.04 according to USB Webcam management, this one can be related with: Bug #224821, Bug #575000, Bug #647501, Bug #144745, Bug #134285 or old Bug #215604.

WebCam seems a touchy subject: it will need time to be solved a believe.

Revision history for this message
naesk (naesk) wrote :

I can confirm my webcam is indeed an external USB device.

Find below both a dmesg & lsusb dump;

$ dmesg
[22396.296024] usb 5-2: new full speed USB device using uhci_hcd and address 3
[22396.460634] usb 5-2: configuration #1 chosen from 1 choice
[22396.505127] uvcvideo: Found UVC 1.00 device USB 2.0 PC Camera (058f:3820)
[22396.509754] input: USB 2.0 PC Camera as /devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0/input/input7
[22396.509903] usbcore: registered new interface driver uvcvideo
[22396.514269] USB Video Class driver (v0.1.0)

$ lsusb
Bus 005 Device 003: ID 058f:3820 Alcor Micro Corp.
Bus 005 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 0458:003a KYE Systems Corp. (Mouse Systems)
Bus 003 Device 002: ID 04f2:0403 Chicony Electronics Co., Ltd KU-0420 keyboard
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Revision history for this message
god (humper) wrote :

Confirm with 10.10 x86_64 and external usb webcam (uvcvideo).
Check via "ps aux" reveals no running instances of camermonitor but I got this error message nevertheless.
Could it be some sort of lock file left somewhere?

Changed in cameramonitor (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

I had this problem as well. The program uses a file ~/.cameramonitor.pid to save the current PID. If it crashes and the PID isn't active all is well. However, if for some reason the old PID matches something that is already running it gives the error. The easy solution is to just delete .cameramonitor.pid. Moving forward the program should check the /proc/PID/cmdline to make sure it truly is already running.

Revision history for this message
Steffen (steffen-stfm) wrote :

Wow, #9 helps for me. I can delete the file and start Cameramonitor and it works.
Thanks for That edemeulle!

Revision history for this message
Steffen (steffen-stfm) wrote :

Hi!

Deleting this pid file solved the problem. You dont have to delete it every startup. One time and the problem is solved. Great!

Thanks!

Steffen

Revision history for this message
naesk (naesk) wrote :

Initially deleting the pid file Cameramonitor actually worked when I plugged in my USB webcam.

Sadly, this was short lived as on a subsequent startup I get same message.

Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

The problem is the camermonitor doesn't always delete the ~/.cameramonitor.pid file and *sometimes* that PID is in use by another program.

Replacing the following function in /usr/shared/pyshared/cameramonitor/utils.py will fix the problem by checking if the PID that ~/.cameramonitor.pid refers to actually is running cameramonitor:

# Check if the process with pid is running
def pid_running(pid):
 if os.path.isdir('/proc/'+pid):
            fd = open('/proc/'+pid+'/cmdline')
            cmd = fd.read()
            return cmd.strip('\x00').endswith('cameramonitor')
        else:
            return False

Revision history for this message
naesk (naesk) wrote :

Thanks :)
Will give it a try and report back.

Revision history for this message
Nick Lib (nikolauslieb) wrote :

Thank you for your insight and your suggested fix, edemeulle. I have run into this bug myself and it can be rather annoying.

I have some experience with python, although I know little about /proc and what kinds of things the "cmdline" entry for a process might possibly contain in general. I was just thinking that it would be possible that (in the future) camera monitor might commonly be started with some arguments and thus it may break your suggested fix (as the arguments will be included in "/proc/pid/cmdline" and thus the string would no longer end with "cameramonitor").

If my mild concern is justified, then (afaik) it would be better to check the "comm" entry in proc, rather than "cmdline".

Also, I would guess that fd should by closed, after use, so perhaps an overall slightly better version of this fix would be:

# Check if the process with pid is running
def pid_running(pid):
      if os.path.isdir('/proc/'+pid):
            with open('/proc/'+pid+'/cmdline') as fd:
                  cmd = fd.read()
                  return cmd.strip() == 'cameramonitor'
      else:
            return False

I hope this helps!

Revision history for this message
Nick Lib (nikolauslieb) wrote :

Well, that was silly of me... forgot to fix my fix for the fix :S . Here's what I meant to post:

# Check if the process with pid is running
def pid_running(pid):
      if os.path.isdir('/proc/' + str(pid)):
            with open('/proc/' + str(pid) + '/comm') as fd:
                  cmd = fd.read()
                  return cmd.strip() == 'cameramonitor'
      else:
            return False

I also added conversion of "pid" to a string, in case it is ever passed as an integer. Testing this on the interactive prompt worked fine for me.

Revision history for this message
Edward DeMeulle (ed-demeulle) wrote :

I agree. That does seem to be a better solution. It is a bit disconcerting that the /proc/#/comm file isn't documented in the manfile for proc, at least with 10.10, but it does work.

Revision history for this message
PhobosK (phobosk) wrote :

Well this issue will be irrelevant in the new version of cameramonitor - 0.3.1 that i am proposing... Because it uses dbus for detection of other running instances... (see my PPA - https://edge.launchpad.net/~phobosk/+archive/phobosk-ppa )
The problem is that I cannot contact the original author of the program so we can arrange a release of the new version officially...
Someone any ideas?

Changed in cameramonitor (Debian):
status: Unknown → New
Revision history for this message
god (humper) wrote :

hopefully this could be resolved once systemd user sessions are in place

Changed in cameramonitor (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.