Threading Exception

529 views
Skip to first unread message

phlepper

unread,
Apr 28, 2015, 3:01:58 PM4/28/15
to home-assi...@googlegroups.com
Just wanted to point out that since I added device_tracker using nmap, I am getting regular threading exceptions to the terminal (OS X):

Exception ignored in: <module 'threading' from '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 1353, in _after_fork
    thread._stop()


I was not getting this before I added device_tracker.  This is with the latest (April 25) release, but I was getting it in the prior release too.  

Let me know if you need additional information...

Thanks,
paul

Ryan Kraus

unread,
Apr 28, 2015, 8:28:38 PM4/28/15
to home-assi...@googlegroups.com
Ooh. That looks ugly. There isn't any more information in the terminal? Does the nmap tracker still work after seeing this error? Have you identified anything that may be related to this error? Check out the home-assistant.log file in your config directory. All information about errors should be routed there.

Andrew Thigpen

unread,
Apr 28, 2015, 8:41:49 PM4/28/15
to home-assi...@googlegroups.com
Hey Paul, I fixed this error a while back: https://github.com/balloob/home-assistant/pull/35.  Can you verify that you are not running a cached version by flushing the __pycache__ directory and restarting?  See also this thread.

-Andrew

phlepper

unread,
Apr 28, 2015, 11:29:30 PM4/28/15
to home-assi...@googlegroups.com
Andrew,

I'm not sure what you mean by flushing __pycache__ directory.  So first I deleted the .pyc files in the main __pycache__ directory (no difference).  Then I deleted the .pyc files in the components/device_tracker folder (still no difference).  I stopped HA, deleted the files, then restarted.

Ryan,

I wasn't getting anything to the log file.  I'm not sure how to change the log level (correctly), so I just went into bootstrap and changed it to .INFO.  Unfortunately, the errors aren't written to the log, only the console.  As near as I can tell, everything is working fine with the tracker, it sees my devices and updates them appropriately when I leave and return.

What I noticed is that the nmap does it's initialization without error:

INFO:homeassistant.loader:Loaded device_tracker.nmap_tracker from homeassistant.components.device_tracker.nmap_tracker
INFO:homeassistant.components.device_tracker.nmap_tracker:Scanning
INFO:homeassistant.components.device_tracker.nmap_tracker:nmap scan successful
INFO:homeassistant.components.device_tracker.nmap_tracker:nmap scanner initialized

< several state settings of my devices snipped>
 
INFO:homeassistant.components.device_tracker:Device tracker interval second=range(0, 60, 12)
INFO:homeassistant:Bus:Handling <Event service_registered[L]: domain=device_tracker, service=reload_devices_csv>
 

But when it comes up a second time (and all subsequent times), then it has the error:

INFO:homeassistant.components.device_tracker.nmap_tracker:Scanning
Exception ignored in: <module 'threading' from '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 1353, in _after_fork
    thread._stop()
TypeError: 'Event' object is not callable
INFO:homeassistant.components.media_player:Updating media_player entities

Happy to collect more info if anyone needs it...

Thanks,
Paul

phlepper

unread,
Apr 28, 2015, 11:34:31 PM4/28/15
to home-assi...@googlegroups.com
And for what it's worth, if I comment out the device_tracker lines from my configuration.yaml, I can confirm the errors go away...

Paul

On Tuesday, April 28, 2015 at 9:29:30 PM UTC-6, phlepper wrote:

Ryan Kraus

unread,
Apr 29, 2015, 12:52:25 AM4/29/15
to home-assi...@googlegroups.com
I double checked back through the code and agree that Andrew's fix for this should have eliminated this problem.

I have two questions:
1) Could you go to homeassistant/__init__.py and copy paste line 779 here. Spoiler alert, if it says:
self._stop = threading.Event()
Then you are not running with the newest version of Home Assistant. On the other hand, if it says:
self._stop_event = threading.Event()
Then it is something else acting up.

2) Have you added any custom code to Home Assistant that is not in the master or dev branch of Paulus's repository?

phlepper

unread,
Apr 29, 2015, 1:39:33 AM4/29/15
to home-assi...@googlegroups.com
Ryan,

I haven't made any changes to the code.  As for __init__.py, my line 779 is
        if blocking:
This is the "call" definition of the "ServiceRegistry" object.

However, my line 832 is
        self._stop_event = threading.Event()
This is in the __init__ def of the Timer object.

Paul

Ryan Kraus

unread,
Apr 29, 2015, 3:55:39 AM4/29/15
to home-assi...@googlegroups.com
My apologies, I was looking at an old version of the code. It does look like you have the newest version though. I'll try digging into it more tomorrow, but, in the meantime, if you go navigate to the home-assistant directory, try typing the following:

python3 -m compileall -f homeassistant

Are you launching Home Assistant in any special way, or just from the command line with the following?
python3 -m homeassistant [OPTIONS]

It really appears as if you are somehow still running an old version and I wonder it there is any funny business going on outside of your control. As another check, you could try adding the logbook component by adding "logbook:" to your config file. If, for some weird reason, an old version of Home Assistant is running, this should throw an error. If the updated version you pulled is correctly running, then a logbook button should appear in the side menu.


Ryan Kraus

--
You received this message because you are subscribed to a topic in the Google Groups "Home Assistant Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/home-assistant-dev/a8zlFl0flr4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to home-assistant-...@googlegroups.com.
To post to this group, send email to home-assi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/home-assistant-dev/80623399-8eea-4fa4-8b29-720abaab36c9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

phlepper

unread,
Apr 29, 2015, 3:19:31 PM4/29/15
to home-assi...@googlegroups.com
Ryan,

I'll look at your first suggestion later today (when I get home).  

However, for your second question, I am just running "python3 homeassistant".  I don't have a '-m' in it.  I think I 'lost' that when I made it into a bash script per another email on this group from Paulus (so that it is in a continuous loop and can restart it via the web UI "Stop" service call). Apparently it's been working without it.

Finally, I can confirm on your third point that I did update to the April 25th version and have logbook running already.   I will also add that I initially installed HA on April 9th, so presumably that was the most recent 'previous' version of HA.

Paul


Ryan Kraus

To unsubscribe from this group and all its topics, send an email to home-assistant-dev+unsub...@googlegroups.com.

To post to this group, send email to home-assi...@googlegroups.com.

phlepper

unread,
Apr 30, 2015, 12:33:38 AM4/30/15
to home-assi...@googlegroups.com
Ryan,

No change with the python3 -m compileall

INFO:homeassistant.components.device_tracker.nmap_tracker:Scanning
Exception ignored in: <module 'threading' from '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py'>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 1353, in _after_fork
    thread._stop()
TypeError: 'Event' object is not callable
INFO:homeassistant.components.media_player:Updating media_player entities

Paul

Ryan Kraus

unread,
May 4, 2015, 1:57:40 AM5/4/15
to home-assi...@googlegroups.com
Ok, you are definitely running the newest version. It looks like Andrew started getting this problem again. You may want to join his conversation on this thread. It looks like he may have some ideas on how to fix it. It appears that the problem may exist outside of Home Assistant.
Reply all
Reply to author
Forward
0 new messages