plivo / plivoframework

Open Source Telephony Application Prototyping Framework
http://www.plivo.com/open-source/
Other
417 stars 180 forks source link

gevent 1.0rc2 breaks plivo #96

Open trane opened 11 years ago

trane commented 11 years ago

Testing an inbound call, with TRACE enabled succeeds with the gevent installed through pip.

However, it fails when using the newest gevent based off of libev.

This is using the newest code from the master branch of plivoframework.

2013-01-25 12:13:12,516 plivo-outbound[1866]: INFO: OutboundServer started at '127.0.0.1:8084'
2013-01-25 12:13:37,485 plivo-outbound[1866]: INFO: (1) New request from ('127.0.0.1', 52571)
2013-01-25 12:13:37,486 plivo-outbound[1866]: DEBUG: (1) [TRACE] run now
2013-01-25 12:13:37,486 plivo-outbound[1866]: DEBUG: (1) Execute: connect args=''
2013-01-25 12:13:37,486 plivo-outbound[1866]: DEBUG: (1) [TRACE] _protocol_send connect 
2013-01-25 12:13:37,490 plivo-outbound[1866]: DEBUG: (1) [TRACE] _protocol_send connect wait ...
2013-01-25 12:13:37,491 plivo-outbound[1866]: ERROR: (1) Traceback (most recent call last):
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/plivo/rest/freeswitch/outboundsocket.py", line 308, in run
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)     self._run()
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/plivo/rest/freeswitch/outboundsocket.py", line 318, in _run
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)     self.connect()
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/plivo/core/freeswitch/outboundsocket.py", line 54, in connect
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)     connect_response = self._protocol_send("connect")
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/plivo/rest/freeswitch/outboundsocket.py", line 140, in _protocol_send
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)     command, args)
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/plivo/core/freeswitch/eventsocket.py", line 376, in _protocol_send
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)     _uuid, event = _async_res.get()
2013-01-25 12:13:37,492 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/gevent/event.py", line 226, in get
2013-01-25 12:13:37,493 plivo-outbound[1866]: ERROR: (1)     result = self.hub.switch()
2013-01-25 12:13:37,493 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 330, in switch
2013-01-25 12:13:37,493 plivo-outbound[1866]: ERROR: (1)     switch_out()
2013-01-25 12:13:37,493 plivo-outbound[1866]: ERROR: (1)   File "/usr/local/lib/python2.7/dist-packages/gevent/hub.py", line 334, in switch_out
2013-01-25 12:13:37,493 plivo-outbound[1866]: ERROR: (1)     raise AssertionError('Impossible to call blocking function in the event loop callback')
2013-01-25 12:13:37,493 plivo-outbound[1866]: ERROR: (1) AssertionError: Impossible to call blocking function in the event loop callback
2013-01-25 12:13:37,493 plivo-outbound[1866]: DEBUG: (1) [TRACE] disconnect now
2013-01-25 12:13:37,493 plivo-outbound[1866]: DEBUG: (1) Releasing Connection ...
2013-01-25 12:13:37,493 plivo-outbound[1866]: DEBUG: (1) [TRACE] releasing ...
2013-01-25 12:13:37,493 plivo-outbound[1866]: DEBUG: (1) [TRACE] releasing forced
mike-plivo commented 11 years ago

ok do you have an idea when gevent (version/commit) added this assertion check ?

whitebook commented 11 years ago

https://github.com/surfly/gevent/commit/05fdc001f70953ec64eda1bc6b6020b0af43a6b9#gevent/hub.py

xmglin commented 11 years ago

Will plivoframework team plan to support gevent-1.0rc2? Is there any schedule?

BrightLedSigns commented 10 years ago

Any chance you could make a note about this issue on this page http://docs.plivo.org/get-started/ ?

I'm new to Plivo, and it took me a while to find this issue and figure out I wasn't doing anything wrong...

BrightLedSigns commented 10 years ago

I should have been more specific...

In it's current state, you can't install the plivo framework.

Within plivo_install.sh, there's these two lines:

pip install --upgrade -f http://gevent.googlecode.com/files/gevent-1.0a3.tar.gz gevent pip install -e git+${PLIVO_GIT_REPO}@${BRANCH}#egg=plivo

The first does install the older version of gevent, but the second triggers some dependency that installs the latest gevent due to some dependency...which renders the install broken due to this issue.

I tried working around it by doing a pip install of the older version, but that triggers a different gevent bug where it requires cython to do the build. That, in turns, fails because cython complains about "default encoding required for conversion" on one of the core files in plivo.

In short, again, at least on a debian box, you can't get a working install of plivo by running the simple "get started" install.

mike-plivo commented 10 years ago

Is it still the same error : "AssertionError: Impossible to call blocking function in the event loop callback"

you see when using last gevent version ?

BrightLedSigns commented 10 years ago

Yes, the same error. I tried it a few more times, and wrote up something with more detail on the Plivo-User's group, here;

https://groups.google.com/forum/#!topic/plivo-users/q3gdHEcDXsU

I was wrong in my assumption that the newer version of gevent was overwriting the older version. It's more straightforward than that. This line:

pip install --upgrade -f http://gevent.googlecode.com/files/gevent-1.0a3.tar.gz gevent

Does not install gevent-1.0a3.tar.gz...it grabs the lastest version of gevent. Must be something about how pip works internally?

astravoice commented 10 years ago

Yes.

On 12/9/13 2:11 PM, Michael Ricordeau wrote:

Is it still the same error : "AssertionError: Impossible to call blocking function in the event loop callback"

you see when using last gevent version ?

— Reply to this email directly or view it on GitHub https://github.com/plivo/plivoframework/issues/96#issuecomment-30163240.

BrightLedSigns commented 10 years ago

I finally hit on something that worked. I replaced this line in plivo_install.sh

pip install --upgrade -f http://gevent.googlecode.com/files/gevent-1.0a3.tar.gz gevent

With this:

pip uninstall gevent pip install -Iv http://gevent.googlecode.com/files/gevent-1.0a3.tar.gz

FYI, that -Iv switch above is a capital letter i, not a lowercase l. The font here on github isn't great for telling the difference.... I and l look the same.

And re-ran the installer. It does prompt me for confirmation during the install, but everything is working now, no "AssertionError: Impossible to call blocking function in the event loop callback" problems with inbound calls.

pubyun commented 10 years ago

please refer to second commit of https://github.com/plivo/plivoframework/pull/108

emamirazavi commented 10 years ago

I've downloaded last version of plivo source with cloning of git in plivo_install.sh I have problem that i think belongs to this issue. Any solution: 2014-01-21 17:00:00,821 plivo-outbound[3251]: INFO: (1) New request from ('127.0.0.1', 59134) 2014-01-21 17:00:00,823 plivo-outbound[3251]: DEBUG: (1) Execute: connect args='' 2014-01-21 17:00:00,827 plivo-outbound[3251]: ERROR: (1) Traceback (most recent call last): 2014-01-21 17:00:00,827 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundsocket.py", line 319, in run 2014-01-21 17:00:00,827 plivo-outbound[3251]: ERROR: (1) self._run() 2014-01-21 17:00:00,827 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundsocket.py", line 329, in _run 2014-01-21 17:00:00,828 plivo-outbound[3251]: ERROR: (1) self.connect() 2014-01-21 17:00:00,828 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/src/plivo/src/plivo/core/freeswitch/outboundsocket.py", line 54, in connect 2014-01-21 17:00:00,828 plivo-outbound[3251]: ERROR: (1) connect_response = self._protocol_send("connect") 2014-01-21 17:00:00,828 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/src/plivo/src/plivo/rest/freeswitch/outboundsocket.py", line 140, in _protocol_send 2014-01-21 17:00:00,828 plivo-outbound[3251]: ERROR: (1) command, args) 2014-01-21 17:00:00,829 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/src/plivo/src/plivo/core/freeswitch/eventsocket.py", line 375, in _protocol_send 2014-01-21 17:00:00,829 plivo-outbound[3251]: ERROR: (1) _uuid, event = _async_res.get() 2014-01-21 17:00:00,829 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/lib/python2.6/site-packages/gevent/event.py", line 226, in get 2014-01-21 17:00:00,829 plivo-outbound[3251]: ERROR: (1) result = self.hub.switch() 2014-01-21 17:00:00,830 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/lib/python2.6/site-packages/gevent/hub.py", line 330, in switch 2014-01-21 17:00:00,830 plivo-outbound[3251]: ERROR: (1) switch_out() 2014-01-21 17:00:00,830 plivo-outbound[3251]: ERROR: (1) File "/usr/local/plivo/lib/python2.6/site-packages/gevent/hub.py", line 334, in switch_out 2014-01-21 17:00:00,830 plivo-outbound[3251]: ERROR: (1) raise AssertionError('Impossible to call blocking function in the event loop callback') 2014-01-21 17:00:00,830 plivo-outbound[3251]: ERROR: (1) AssertionError: Impossible to call blocking function in the event loop callback 2014-01-21 17:00:00,831 plivo-outbound[3251]: DEBUG: (1) Releasing Connection ...

csik commented 10 years ago

Just to confirm that BrightLedSigns' fix worked for me; I didn't have to rerun install.sh, just restarted the plivo processes.

AndreiPashkin commented 9 years ago

Fixed it in #132