It only creates infinite loops if it's in the welcome application...which it isn't (as I specified in step 2).
In either case, we still need more information. On Feb 6, 12:04 pm, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > 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 <tfarr...@owassobible.org> 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 <vihan...@gmail.com> 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