Hello there again!

I've added some logging and with a double click submit I can see the
the response crashes before the return UL(*items).xml() part in the
first search function.

I hope this helps.

Best regards,
Mate

On Jun 24, 8:57 pm, ScOut3R <mailingl...@modernbiztonsag.org> wrote:
> I've added session.unlock to each of the functions and it seems stable
> except under one condition and that is if I'm accidentally double
> click the submit button.
>
> I'm using MySQL as the backend.
>
> The first function (bg_quick_dvd()) got executed and it returns the
> value but the following just times out. I'll try to figure out at
> which part.
>
> On Jun 24, 8:24 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
>
>
> > This needs to be investigated. I think it may be a problem with
> > fcgi.py, not with web2py itself. Anywya, let's rule out problems with
> > session locking. Try add
>
> > session.unlock()
>
> > to those actions called via ajax that do not write session variables.
> > Do you still get the problem?
>
> > Do you use sqlite?
>
> > Can you add some print/logging statements to see which actions are
> > called, in which order and if they return?
>
> > On Jun 24, 12:14 pm, ScOut3R <mailingl...@modernbiztonsag.org> wrote:
>
> > > Dear List,
>
> > > the ajax based background search crashes my web2py installation. It's
> > > version 1.77.3 and I'm using the fcgihandler to access the
> > > application. OS: OpenBSD 4.6, Python version is Python 2.5.4
> > > (r254:67916, Oct 19 2009, 01:52:14).
>
> > > As You can see below the search makes three database queries. The
> > > first search attempt works and the second crashes web2py. Would You be
> > > so kind to look into it?
>
> > > The error is the following:
>
> > > Unhandled exception in thread started by <bound method Connection.run
> > > of <gluon.contrib.gateways.fcgi.Connection object at 0x8b5af36c>>
> > > Traceback (most recent call last):
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 664, in run
> > >     self.process_input()
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 700, in process_input
> > >     self._do_params(rec)
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 799, in _do_params
> > >     self._start_request(req)
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 783, in _start_request
> > >     req.run()
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 592, in run
> > >     self._flush()
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 599, in _flush
> > >     self.stdout.close()
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 358, in close
> > >     self._conn.writeRecord(rec)
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 715, in writeRecord
> > >     rec.write(self._sock)
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 552, in write
> > >     self._sendall(sock, header)
> > >   File "/var/www/web2py/prod/gluon/contrib/gateways/fcgi.py", line
> > > 529, in _sendall
> > >     sent = sock.send(data)
> > > socket.error: (32, 'Broken pipe')
>
> > > The jquery snippet that calls the background functions:
>
> > > function dvd() { ajax('bg_quick_dvd', ['keyword', 'option'],
> > > 'target_dvd'); }
> > > function music_cd() { ajax('bg_quick_music_cd', ['keyword', 'option'],
> > > 'target_music_cd'); }
> > > function book() { ajax('bg_quick_book', ['keyword', 'option'],
> > > 'target_book');
>
> > > function start() {
> > >         if(jQuery('#title').attr('checked'))
> > >                 jQuery('#option').val('1');
> > >         if(jQuery('#store').attr('checked'))
> > >                 jQuery('#option').val('0');
>
> > >         dvd();
> > >         setTimeout('music_cd()', 150);
> > >         setTimeout('book()', 300);
>
> > > }
>
> > > And the backround functions:
>
> > > def bg_quick_dvd():
> > >         if (request.vars.option == '1'):
> > >                 pattern = '%' + request.vars.keyword + '%'
> > >                 dvds = db((db.dvds.user==user_id) &
> > > (db.dvds.title.like(pattern))).select(orderby=db.dvds.title)
> > >         else:
> > >                 dvds = db((db.dvds.user==user_id) &
> > > (db.dvds.store==request.vars.keyword)).select(orderby=db.dvds.title)
> > >         items = [A(row.title, _href=URL(c='dvd', r=request, f='show',
> > > args=row.id)) for row in dvds]
> > >         return UL(*items).xml()
>
> > > @auth.requires_login()
> > > def bg_quick_music_cd():
> > >         if (request.vars.option == '1'):
> > >                 pattern = '%' + request.vars.keyword + '%'
> > >                 music_cds = db((db.music_cds.user==user_id) &
> > > (db.music_cds.title.like(pattern))).select(orderby=db.music_cds.title)
> > >         else:
> > >                 music_cds = db((db.music_cds.user==user_id) &
> > > (db.music_cds.store==request.vars.keyword)).select(orderby=db.music_cds.tit
> > >  le)
> > >         items = [A(row.title, _href=URL(c='music_cd', r=request, f='show',
> > > args=row.id)) for row in music_cds]
> > >         return UL(*items).xml()
>
> > > @auth.requires_login()
> > > def bg_quick_book():
> > >         if (request.vars.option == '1'):
> > >                 pattern = '%' + request.vars.keyword + '%'
> > >                 books = db((db.books.user==user_id) &
> > > (db.books.title.like(pattern))).select(orderby=db.books.title)
> > >         else:
> > >                 books = db((db.books.user==user_id) &
> > > (db.books.store==request.vars.keyword)).select(orderby=db.books.title)
> > >         items = [A(row.title, _href=URL(c='book', r=request, f='show',
> > > args=row.id)) for row in books]
> > >         return UL(*items).xml()
>
> > > Best regards,
> > > Mate

Reply via email to