ListenProcess error[Errno 22] Invalid argument

Posted on
Fri Mar 29, 2019 10:24 am
dkillmer offline
Posts: 23
Joined: Feb 23, 2015

ListenProcess error[Errno 22] Invalid argument

Hi, there.

The UniFiAP plugin has worked flawlessly for months and this week it stopped receiving the status of unifi created devices. If I restart the plugin or restart the UniFi AP it will work again for a short time. I have tried restarting everything but the problem persists. From everything we can tell, all our network devices are online and working properly.

I am receiving the following messages in the Indigo event log when it stops receiving the status:
ListenProcess error[Errno 22] Invalid argument
APdict stop in getMessage stop=True for ip#xxx.xxx.xxx.xxx.

I had two updates this week, so it is likely one of these that caused the problem: the latest MacOS update and the latest UniFi controller/Cloud Key firmware update.

Is anyone else having this problem?

Thank you!

Dennis

Posted on
Fri Mar 29, 2019 10:28 am
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

I am out of town. Will check after april10.


Sent from my iPhone using Tapatalk

Posted on
Fri Apr 05, 2019 10:29 am
dkillmer offline
Posts: 23
Joined: Feb 23, 2015

Re: ListenProcess error[Errno 22] Invalid argument

Hi, Karl.

The error went away after I set "use controller info" to off and reloaded the plugin.

Thank you for all your work on this plugin and it is the best I have found for determining if we are home or away.

Dennis

Posted on
Mon Apr 15, 2019 10:59 am
dkillmer offline
Posts: 23
Joined: Feb 23, 2015

Re: ListenProcess error[Errno 22] Invalid argument

Update - these errors eventually started showing up on my APs and device status for online devices says expired. Restarting the plugin works for a short time.

Posted on
Mon Apr 15, 2019 12:00 pm
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

Today I got my second eye fixed.
Can do some programming again starting tomorrow.

give me a day. will be checking


Karl

Posted on
Sun Apr 21, 2019 5:42 pm
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

thank to Wouter to point out: there are option for the "tail" commands (the plugin listens to log files on the unify devices with tail-f or tail -F)

Newer versions of switches .. AP software can do "tail -F" older need to use "tail -f"

You need to set those options in config for
-USG
-switches
-AP
-video (if you use that)
-no option for the controller software. tail -F should always work (well not on windows)

tail-F has the benefit that it will "tail" rotating log files while "tail -f" will stop working when a logfile gets recycled on the switches ...

the plugin will cover that, but it will need several minutes to detect that there is no response from tail-f and the will relaunch the tail-f command to the sw/ap.. that has a new logfile.


That option was introduced some time ago, just forgot that it has this side effect.

Karl
Attachments
Screen Shot 2019-04-21 at 18.35.34.png
Screen Shot 2019-04-21 at 18.35.34.png (33.03 KiB) Viewed 515 times
Screen Shot 2019-04-21 at 18.35.53.png
Screen Shot 2019-04-21 at 18.35.53.png (7.15 KiB) Viewed 515 times
Screen Shot 2019-04-21 at 18.35.02.png
Screen Shot 2019-04-21 at 18.35.02.png (34.13 KiB) Viewed 515 times

Posted on
Sun Apr 21, 2019 6:33 pm
dkillmer offline
Posts: 23
Joined: Feb 23, 2015

Re: ListenProcess error[Errno 22] Invalid argument

Thank you, Karl and Wouter! I will give this a try.

Dennis

Posted on
Tue Apr 23, 2019 10:50 am
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

Dennis

it seems this a deeper problem.

I can not recreate the problem no matter what, Wouter can

it must be either OSX, python,plugin

I have added an error recovery for this special issue.
it will kill the listener and restart it. Not a fix but a work around

could you try this one:
https://www.dropbox.com/s/ffijjgzds5aougs/uniFiAP.indigoPlugin.zip?dl=1

Karl

Posted on
Tue Apr 23, 2019 11:35 am
howartp offline
Posts: 3635
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: ListenProcess error[Errno 22] Invalid argument

Not related to case-sensitive installs of OSX?


Sent from my iPhone using Tapatalk Pro

Posted on
Tue Apr 23, 2019 11:37 am
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

Have not check that one. But the paths should be ok

Good suggestion will check.

Karl.


Sent from my iPhone using Tapatalk

Posted on
Tue Apr 23, 2019 11:45 am
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

the paths and files names are correct w upper / lower case.
And the read is listening to a pipe not reading a file (name)

this has worked for years, and for some it just stopped now. Also older plugin versions have the same issue.


this is a simplified version
Code: Select all
#! /usr/bin/env python
# -*- coding: utf-8 -*-
####################

import subprocess
import fcntl
import os
import sys
import time

uid = "xx"
passwd = "xx"
ip =  "192.168.1.xx"

#cmd= "/usr/bin/expect   execLog.exp '"+uid+"' '"+passwd+"' "+ip+" BZ.v '/usr/bin/tail -F /var/log/messages'"

cmd = "/usr/bin/expect   dictLoop.exp  '"+uid+"' '"+passwd+"' "+ip+" BZ.v xxxThisIsTheEndTokenxxx 60 40 \"mca-dump | sed -e 's/^ *//'\"   /var/log/messages"

print cmd
ListenProcess = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

# set the O_NONBLOCK flag of ListenProcess.stdout file descriptor:
flags = fcntl.fcntl(ListenProcess.stdout, fcntl.F_GETFL)  # get current p.stdout flags
fcntl.fcntl(ListenProcess.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK)


while True:
   try:
      linesFromServer = os.read(ListenProcess.stdout.fileno(),32767) ## = 32k
      print unicode(linesFromServer)
   except   Exception, e:
      if unicode(e).find("[Errno 35]") == -1:    # "Errno 35" is the normal response if no data, if other error: exit
         if len(unicode(e)) > 5:
            print "os.read(ListenProcess.stdout.fileno(),32767) has error in Line '%s' has error='%s'" % (sys.exc_traceback.tb_lineno, e)
            print "... ListenProcess for ip: "+ip+"    ListenProcessObject: "+ unicode(ListenProcess)
            try:     print "..."+ unicode(ListenProcess.stdout)
            except: print "...  ListenProcess.stdout  not printable"
            try:     print "..."+ unicode(ListenProcess.stdout.fileno())
            except: print "...  ListenProcess.stdout.fileno()  not printable"
   time.sleep(1)

Posted on
Tue Apr 23, 2019 7:12 pm
dkillmer offline
Posts: 23
Joined: Feb 23, 2015

Re: ListenProcess error[Errno 22] Invalid argument

Karl,

This started happening right after the latest MacOS update.

I tried the dropbox link and I get "Error (404) We can't find the page you're looking for".

Sure appreciate all your efforts,

Dennis

Posted on
Tue Apr 23, 2019 7:14 pm
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

https://www.dropbox.com/s/lrbkt6hvh3qbo ... n.zip?dl=1

Try this one.


Sent from my iPhone using Tapatalk

Posted on
Tue Apr 23, 2019 7:22 pm
dkillmer offline
Posts: 23
Joined: Feb 23, 2015

Re: ListenProcess error[Errno 22] Invalid argument

That worked, thanks!

I purchased my devices in December, 2017 and wondered if I should use new version or old version of the the tail command configuration.

Thanks again,
Dennis

Posted on
Tue Apr 23, 2019 7:23 pm
kw123 offline
User avatar
Posts: 6506
Joined: May 12, 2013
Location: Dallas, TX

Re: ListenProcess error[Errno 22] Invalid argument

The new one with the -F


and could you open terminal and type:
python --version

mine shows:
Python 2.7.10
in high sierra and mojave

Sent from my iPhone using Tapatalk

Who is online

Users browsing this forum: No registered users and 0 guests