wait...
def index():
import urllib2
url = 'http://127.0.0.1:8000/welcome/default/index'
resp = urllib2.urlopen(url).read()
return resp + "blah"
This creates an infinite loops that spans more and more threads.
I assumed from the original post, the urllopen code was outside a
controller or at least in a function not calling itself.
On Feb 6, 10:08 am, Timbo <[email protected]> wrote:
> If you've only got one thread running, then yes, this will deadlock on
> any threaded server.
>
> Rocket was certainly not made to not allow lookups back to itself.
>
> Where are you putting this code? If by assigning to "response" are
> you masking web2py's response object?
>
> I...
> 1) downloaded a fresh copy of web2py
> 2) created a fresh application
> 3) set the index(): to:
> def index():
> import urllib2
> url = 'http://127.0.0.1:8000/welcome/default/index'
> resp = urllib2.urlopen(url).read()
> return resp + "blah"
>
> I got the expected result.
>
> I need a little more information to debug this.
>
> -tim
>
> On Feb 6, 12:23 am, vihang <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Code:
>
> > import urllib2
> > url = 'http://127.0.0.1/server/default/index'
> > response = urllib2.urlopen(url)
>
> > Here 127.0.0.1 is the same web2py from which this code is being
> > called. On doing so, the web2py hangs. I debugged the issue to Rocket,
> > where it does not allocate a new thread to request (active_queue.get()
> > does not return a new thread required to complete the response), as
> > the current session is already using one. This is not a problem with
> > other web servers.
>
> > Is this a bug or just the way Rocket server was made to behave?
>
> > Vihang