On Apr 26, 6:43 pm, edgarsmolow <[email protected]> wrote:
> Someone pointed out this article about caching:
>
> http://entitycrisis.blogspot.com/2007/06/something-looks-like-pylons-...
>
> Turns out that there's an issue with SQLAlchemy leaving stuff around
> from a previous request. Calling session.clear() before making a
> request seems to fix the problem.  I wonder if there's a setting
> someone that can automatically accomplish the same thing, obviating
> having to call session.clear() in nearly every controller.

When using SQLAlchemy's thread-scoped Session[1] (which could be
considered the default when using SA from Pylons), you normally call
Session.remove() in the base controller's call method, probably in a
finally block.

[1] 
http://www.sqlalchemy.org/docs/05/session.html#lifespan-of-a-contextual-session


> Thanks.
> Edgar
>
> On Apr 26, 6:31 pm, edgarsmolow <[email protected]> wrote:
>
> > No, I'm using MySQL 5.x.
>
> > > > OperationalError: (OperationalError) (2006, 'MySQL server has gone
> > > > away')
>
> > Is there an issue with connection pools?
>
> > Edgar
>
> > On Apr 26, 5:56 pm, Wyatt Baldwin <[email protected]> wrote:
>
> > > > On Apr 26, 12:56 am, Wyatt Baldwin <[email protected]>
> > > > wrote:
>
> > > > > On Apr 25, 7:14 pm, edgarsmolow <[email protected]> wrote:
>
> > > > > > Works fine on my workstation, but after deploying the site to our 
> > > > > > web
> > > > > > server, I'm seeing a strange error.  The first time I go to a page,
> > > > > > unable to connect to the database which causes an error page to be
> > > > > > displayed.  Refresh the page, and voila! the page works just fine.
>
> > > > > > Does anyone know why it can't connect to the database during the
> > > > > > initial visit to the page, but can connect after that?
>
> > > > > Most likely because that first request causes some initialization to
> > > > > happen.
>
> > > On Apr 26, 8:28 am, edgarsmolow <[email protected]> wrote:
>
> > > > Wyatt,
>
> > > > It works just fine on my workstation.  Could this be an issue in
> > > > difference between .ini files?
>
> > > It's hard to say, but it's certainly possible.
>
> > > > An email is sent by the site when this occurs (i.e., often).  This is
> > > > the error:
>
> > > > OperationalError: (OperationalError) (2006, 'MySQL server has gone
> > > > away') u'SELECT accounts.id AS accounts_id, accounts.acct_no AS
> > > > accounts_acct_no, ...................
>
> > > Oh, you're using the Oracle Lite DB (Community Edition, I assume)?
> > > That could be part of the problem, as it's got some annoying issues.
> > > You might consider upgrading to the full Enterprise version.
>
> > > > Looks like for some reason the app is unable to connect to MySQL.  It
> > > > seems that, by refreshing the page, a connection is made and the error
> > > > doesn't occur.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to