EventStream does not connect during subscribe unless debugging
See original GitHub issuePlease answer these questions before submitting your issue. Thanks!
What version of Python are you using (python -V
)?
Python 3.6.3 :: Anaconda custom (64-bit)
What operating system and processor architecture are you using (python -c 'import platform; print(platform.uname());'
)?
uname_result(system=‘Darwin’, node=‘XXX’, release=‘17.3.0’, version=‘Darwin Kernel Version 17.3.0: Thu Nov 9 18:09:22 PST 2017; root:xnu-4570.31.3~1/RELEASE_X86_64’, machine=‘x86_64’, processor=‘i386’)
Which Python packages do you have installed (run the pip freeze
or pip3 freeze
command and paste output)?
chardet==3.0.4 click==6.7 Django==1.11.7 enum34==1.1.6 Flask==0.12.2 html5lib==0.9999999 idna==2.6 itsdangerous==0.24 Jinja2==2.10 Markdown==2.6.10 MarkupSafe==1.0 monotonic==1.4 nose==1.3.7 numpy==1.13.3 protobuf==3.5.0.post1 pytz==2017.3 requests==2.18.4 six==1.11.0 sseclient==0.0.18 tensorflow==1.4.1 tensorflow-tensorboard==0.4.0rc3 urllib3==1.22 Werkzeug==0.13
Which Arlo hardware do you have (camera types - [Arlo, Pro, Q, etc.], basestation model, etc.)?
H6
What did you do?
Sample Code
import Arlo
UID='XXX'
PWD='XXX'
try:
arlo = Arlo.Arlo(UID,PWD)
print('Logged In')
cameras = arlo.GetDevices('camera')
firstCamera = cameras[0]
print('got camera')
cameraProperties = arlo.GetCameraState(firstCamera)['properties']
print('got properties')
batteryLevel = cameraProperties[0]['batteryLevel']
print('Battery Level: %d' % batteryLevel)
arlo.Logout()
print('Logged Out')
except Exception as e:
print(e)
What did you expect to see?
Logged In
got camera
got properties
Battery Level: 66
Logged Out
Process finished with exit code 0
What did you see instead?
without debugger, using Arlo commit aa4f976 from 9/8/17
/Users/jim/anaconda3/bin/python /Users/jim/xxx/bugdemo.py
Logged In
got camera
got properties
Battery Level: 66
Logged Out
Process finished with exit code 0
with debugger, using Arlo commit b43f191 from 12/8/17
/Users/jim/anaconda3/bin/python "/Applications/Development/PyCharm CE.app/Contents/helpers/pydev/pydevd.py" --multiproc --qt-support=auto --client 127.0.0.1 --port 58784 --file /Users/jim/xxx/bugdemo.py
pydev debugger: process 83482 is connecting
Connected to pydev debugger (build 173.4127.16)
Logged In
got camera
got properties
Battery Level: 66
Logged Out
Process finished with exit code 0
without debugger, using Arlo commit b43f191 from 12/8/17
/Users/jim/anaconda3/bin/python /Users/jim/xxx/bugdemo.py
Logged In
got camera
<program hangs>
underlying problem
at Arlo.py line 273 in Arlo.Subscribe
while not self.event_streams[basestation_id].connected:
time.sleep(1)
condition is never satisfied.
Does this issue reproduce with the latest release?
yes
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Server sent event EventStream does not trigger "onmessage ...
According to the screenshot, your event-stream contains events of type "foo" , not "message" . That is only the default type (absent an ......
Read more >Event does not show up in the Chrome EventStream subtab ...
If I use the native EventSource, I can see messages coming through with the ... subtab inside the Network tab when viewing the...
Read more >Problems on delivery | Twilio
EventStreams will notify you about any issue listed here using Twilio Debugger. Depending on your configuration you wil receive mailing events, lists in...
Read more >Server-sent events: a simple way to stream events from a server
Right now I have a web service that starts virtual machines, and the client polls the server until the virtual machine is up....
Read more >Troubleshooting AWS IoT Greengrass
If the AWS IoT Greengrass Core software does not start, try the following ... and make sure that the subscription listed in the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I see what is happening.
During the refactor process in Arlo.Subscribe, the original lines self.event_streams[basestation_id] = EventStream(QueueEvents, args=(self, event_stream,)) self.event_streams[basestation_id].Start() were combined into self.event_streams[basestation_id] = EventStream(QueueEvents, args=(self, event_stream,)).Start() The call to Start() happens before the EventStream object is put into event_streams[basestation_id]. This means when QueueEvents is trying to process the ‘connect’ message, there might be no entry for the basestation in event_streams yet, so the message would be ignored.
Race indeed!
Hope that helps.
From: jeffreydwalter notifications@github.com Reply: jeffreydwalter/arlo reply@reply.github.com Date: January 2, 2018 at 11:45:07 PM To: jeffreydwalter/arlo arlo@noreply.github.com Cc: jletts jim@letts.org, Mention mention@noreply.github.com Subject: Re: [jeffreydwalter/arlo] EventStream does not connect during subscribe unless debugging (#36)
@jletts I think I worked around the issue with this commit 2b65e21
Seems like after my refactor which moved the SSEClient object creation into the EventStream object there’s a race condition there. I will continue to investigate to see if I can come up with a more proper fix.
In the meantime, this change should get you going. Please let me know what your experience is.
Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Since Arlo Go has 3G and no basestation, it effectively is it’s own basestation. That’s why you only get a device back. Arlo has made kind of a mess with their device type stuff imo.
As for the race condition, You were right! Great catch and thank you for your insight!
I fixed the bug here: https://github.com/jeffreydwalter/arlo/commit/1b68464bec8fbcd593f07bb49f7cfb05281e9c51.
Let me know if you come across any more issues.
Thanks again!