BreeeZe / rpos

Raspberry Pi Onvif Server
http://breeeze.github.io/rpos
MIT License
643 stars 146 forks source link

Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called more than once without closing #135

Open jonathan84clark opened 2 years ago

jonathan84clark commented 2 years ago

Hello,

I have been working on an issue with rpos. I have a Raspberry PI3 compute module with the (old) Jessie OS installed running rpos with no problems. When I do an in-place OS upgrade from Jessie -> Buster then try to run rpos I get the following error: Starting camera settings webserver on http://192.168.2.10:8081/ Binding MediaService to http://192.168.2.10:8081/onvif/media_service Binding PTZService to http://192.168.2.10:8081/onvif/ptz_service Uncaught Exception... : Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called more than once without closing. at Server.listen (net.js:1366:11) at PTZService.SoapService.start (/home/pi/rpos/lib/SoapService.js:26:24) at Object. (/home/pi/rpos/rpos.js:33:13) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19)

Steps to Reproduce

  1. Start with a working install of rpos on the raspberry PI Jessie OS
  2. Run rpos using the following command 'sudo node rpos.js'
  3. Not starts successfully
  4. Perform an in-place OS upgrade using the following steps sudo echo "deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list sudo echo "deb http://archive.raspberrypi.org/debian/ buster main ui" > /etc/apt/sources.list.d/raspi.list sudo apt-get update sudo apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade (Wait ~50 minutes for the install to finish)
  5. Reboot the system
  6. Run rpos using the following command 'sudo node rpos.js' Here is the output I am seeing: Read IP address 192.168.2.10 from lo Manufacturer : SSG Model : MVC-ETH HardwareId : SerialNumber : 0000000068e8348c FirmwareVersion : 2.0.0 Starting camera settings webserver on http://192.168.2.10:8081/ Binding DeviceService to http://192.168.2.10:8081/onvif/device_service Binding MediaService to http://192.168.2.10:8081/onvif/media_service Binding PTZService to http://192.168.2.10:8081/onvif/ptz_service discovery_service started Uncaught Exception... : Error: listen EADDRINUSE :::8081 at Object.exports._errnoException (util.js:1020:11) at exports._exceptionWithHostPort (util.js:1043:20) at Server._listen2 (net.js:1262:14) at listen (net.js:1298:10) at Server.listen (net.js:1394:5) at DeviceService.SoapService.start (/home/pi/rpos/lib/SoapService.js:26:24) at Object. (/home/pi/rpos/rpos.js:31:16) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) modprobe: FATAL: Module bcm2835_v4l2 is in use.

Other Notes I tried a number of different things to resolve this issue.

  1. I was using an older version of rpos so I did a 'git pull' to update to the latest version, no luck
  2. I changed the port from 8081 to 8082 and I got the same result
  3. I performed an analysis on the used ports 'sudo netstat -tulpn' I found the following ports in use after a reboot on buster Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 0.0.0.0:111 0.0.0.0: LISTEN 1/init
    tcp 0 0 0.0.0.0:8722 0.0.0.0:
    LISTEN 600/sshd
    tcp 0 0 0.0.0.0:53 0.0.0.0: LISTEN 602/dnsmasq
    tcp6 0 0 :::111 :::
    LISTEN 1/init
    tcp6 0 0 :::8722 ::: LISTEN 600/sshd
    tcp6 0 0 :::53 :::
    LISTEN 602/dnsmasq
    udp 0 0 0.0.0.0:53 0.0.0.0: 602/dnsmasq
    udp 0 0 0.0.0.0:68 0.0.0.0:
    575/dhcpcd
    udp 0 0 0.0.0.0:111 0.0.0.0: 1/init
    udp 0 0 192.168.2.10:123 0.0.0.0:
    589/ntpd
    udp 0 0 192.168.1.126:123 0.0.0.0: 589/ntpd
    udp 0 0 0.0.0.0:123 0.0.0.0:
    589/ntpd
    udp 0 0 0.0.0.0:47842 0.0.0.0: 448/avahi-daemon: r udp 0 0 0.0.0.0:5353 0.0.0.0: 448/avahi-daemon: r udp6 0 0 :::53 ::: 602/dnsmasq
    udp6 0 0 :::111 :::
    1/init
    udp6 0 0 fe80::6fd3:d7b1:713:123 ::: 589/ntpd
    udp6 0 0 ::1:123 :::
    589/ntpd
    udp6 0 0 :::123 ::: 589/ntpd
    udp6 0 0 :::5353 :::
    448/avahi-daemon: r udp6 0 0 :::45291 :::* 448/avahi-daemon: r As you can see, there is no current usage of port 8081
  4. Attempted to remove and re-install rpos (this failed miserably, it seems that rpos is can no longer be installed, I filed a separate defect report on that issue)

At this point I'm not sure what else I can do.

If I can get help with this, that would be great!

Thanks,

Jonathan L Clark