Recorded videos not detected on FreeBSD



  • I have been able to get Shinobi running in a FreeBSD jail. I've contributed an installer script to the repository as well. FreeBSD Installer Script

    Shinobi works well and records videos as expected. Unfortunately Shinobi doesn't seem to see these files once they are on the file system. According to the documentation this should function correctly on FreeBSD given the availability of kqueue. I've confirmed this exists in my kernel.

    I haven't been able to find anything terribly useful in the logs to help understand what exactly is going wrong. I'm opening this bug to find out the best way for me to help you debug this problem and ultimately get this fixed. Please let me know how I can enable more verbose logging to help narrow down the problem.


  • administrators

    Going to post these for reference
    https://stackoverflow.com/questions/5877263/monitoring-directory-for-changes-potential-high-memory

    I wonder if this fallsback to regular polling if kqueue is not found https://www.npmjs.com/package/node-watch



  • Posting for reference as well: https://github.com/paulmillr/chokidar



  •  # ./node_modules/.bin/chokidar "testfswatch/*"
    Watching "testfswatch/*" ..
    add:testfswatch/mytest
    unlink:testfswatch/mytest
    add:testfswatch/mytest
    add:testfswatch/mytest2
    unlink:testfswatch/mytest
    unlink:testfswatch/mytest2
    

    I installed and tested the chokidar watch cli in my jail. Events are working and this seems to be a wrapper for fs.watch on the FreeBSD platform. Maybe we should start with more logging options to determine why the watches are failing for Shinobi in the current iteration.



  • Another interesting session:

    # Watching my nullfs mount directly
    [email protected]_1:~ # ./node_modules/.bin/chokidar "/mnt/cctv/videos/*" 
    Watching "/mnt/cctv/videos/*" ..
    add:/mnt/cctv/videos/testfile2
    add:/mnt/cctv/videos/testfile23
    add:/mnt/cctv/videos/testfile3
    ^C
    
    # attempting to watch a symlinked directory fails
    [email protected]_1:~ # ./node_modules/.bin/chokidar "/usr/local/shinobi/videos/*"
    add:/usr/local/shinobi/videos
    Watching "/usr/local/shinobi/videos/*" ..
    ^C
    
    # passing -s enables it to follow symlinks and this works
    [email protected]_1:~ # ./node_modules/.bin/chokidar "/usr/local/shinobi/videos/*" -s
    Watching "/usr/local/shinobi/videos/*" ..
    add:/usr/local/shinobi/videos/testfile6
    add:/usr/local/shinobi/videos/testfile7
    

    Maybe the fix is to enable following of symlinks for the fs.watch?


  • administrators

    very nice, ill give it a go 😄 thank you! saves me a lot of headache!



  • One thing I also noticed was the chokidar-cli tool didn't watch the directory recursively with the match pattern I used. /my/path/* I also didn't see a recursive option in the help text.

    I'd be interested to know if you are using a fs.watch for each camera's directory or if you are setting a top level watch and expecting events to bubble all the way up. Might just be an option that the chokidar-cli tool doesn't have.



  • 2|shinobi- | 2017-12-06T10:52:14-08:00 TypeError: "list" argument must be an Array of Buffer or Uint8Array instances
    2|shinobi- |     at Function.Buffer.concat (buffer.js:444:13)
    2|shinobi- |     at Socket.<anonymous> (/usr/local/shinobi/plugins/motion/shinobi-motion.js:197:55)
    2|shinobi- |     at Socket.Emitter.emit (/usr/local/shinobi/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20)
    2|shinobi- |     at Socket.onevent (/usr/local/shinobi/node_modules/socket.io-client/lib/socket.js:270:10)
    2|shinobi- |     at Socket.onpacket (/usr/local/shinobi/node_modules/socket.io-client/lib/socket.js:232:12)
    2|shinobi- |     at Manager.<anonymous> (/usr/local/shinobi/node_modules/component-bind/index.js:21:15)
    2|shinobi- |     at Manager.Emitter.emit (/usr/local/shinobi/node_modules/socket.io-client/node_modules/component-emitter/index.js:133:20)
    2|shinobi- |     at Manager.ondecoded (/usr/local/shinobi/node_modules/socket.io-client/lib/manager.js:332:8)
    2|shinobi- |     at Decoder.<anonymous> (/usr/local/shinobi/node_modules/component-bind/index.js:21:15)
    2|shinobi- |     at Decoder.Emitter.emit (/usr/local/shinobi/node_modules/component-emitter/index.js:134:20)
    

    This was output in the logs when starting a recording session on a camera. Seems related to the motion plugin.



  • I turned on recording and used the chokidar command to watch that directory:

    [email protected]_1:~ # ./node_modules/.bin/chokidar "/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/*" 
    Watching "/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/*" ..
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    change:/usr/local/shinobi/videos/LNbW6TVpPc/5cCyJhLtpN/2017-12-06T10-52-14.mp4
    

    Seems to work great, so this whole fs.watch thing might be a red herring. Not sure.



  • I am having the same issue. Nothing in the logs. Anything I can do to help troubleshoot for you?



  • I also have the same problem. How can I repair it?


 

Looks like your connection to Shinobi Forum was lost, please wait while we try to reconnect.