the latest version of MySQLDB does use weakrefs right at the heart of
things, in connections.py and cursors.py.    since we are catching the
exception we cant see the full original stack trace but its possible
that it would trace into mysqldb's source code.

that doesnt rule out that we are doing something to cause this to
happen in SA, but im pretty sure people are using pool_recycle with
mysql successfully.

On Jun 1, 1:11 am, "Mike Orr" <[EMAIL PROTECTED]> wrote:
> It happens only when the site has been idle for several hours; i.e.
> overnight.  Once it starts it keeps happening every request until I
> restart the application.
>
> The first time it happened, somebody had gotten a "MySQL server has
> gone away" error during the night, followed by a couple weak-reference
> errors.  I noticed that pool_recycle wasn't being passed properly and
> fixed it.
>
> Since then I've gotten weak-reference errors almost every morning, but
> without the server-gone error.  I restart the server and it runs the
> rest of the day.
>
> Today I upgraded from MySQLdb 1.2.0 to 1.2.2 so maybe that will fix it.
>
> --Mike
>
> On 5/31/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > nothing is weakly referenced within the block where that exception is
> > being thrown.  the only place weakrefs are used outside of the ORM is
> > a couple of dictionaries in pool.py.  you havent said what reproduces
> > this problem ?  you just start the app, and it happens every time ?
>
> > On May 31, 6:01 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote:
> > > I've been getting this on my Pylons site.
>
> > > sqlalchemy.exceptions.SQLError: (ReferenceError) weakly-referenced
> > > object no longer exists
>
> > > It's trying to execute an ORM .select() call.  The first time was
> > > after a "MySQL server has gone away" error, so I assumed some mapped
> > > instances had been orphaned.  But now I'm still getting it even though
> > > I've set .pool_recycle to 1 hour and restarted the application several
> > > times.
>
> > > I've got SQLAlchemy 0.3.7 on the server, which is where the error is
> > > occuring.  My workstation has the trunk version, but I probably don't
> > > keep the app running long enough to give this a chance to happen.
>
> > > The full traceback follows.
>
> > > File '/mnt/data/www/apps/inews2/inews/controllers/main.py', line 14 in 
> > > index
> > >   c.top = model.list_incidents(top_only=True)
> > > File '/mnt/data/www/apps/inews2/inews/models/__init__.py', line 60 in
> > > list_incidents
> > >   return q.select(order_by=order_by, offset=offset, limit=limit)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/orm/query.py',
> > > line 319 in select
> > >   return self.select_whereclause(whereclause=arg, **kwargs)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/orm/query.py',
> > > line 326 in select_whereclause
> > >   return self._select_statement(statement, params=params)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/orm/query.py',
> > > line 927 in _select_statement
> > >   return self.execute(statement, params=params, **kwargs)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/orm/query.py',
> > > line 831 in execute
> > >   result = self.session.execute(self.mapper, clauseelement, params=params)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/orm/session.py',
> > > line 183 in execute
> > >   return self.connection(mapper,
> > > close_with_result=True).execute(clause, params, **kwargs)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/engine/base.py',
> > > line 509 in execute
> > >   return Connection.executors[c](self, object, *multiparams, **params)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/engine/base.py',
> > > line 549 in execute_clauseelement
> > >   return self.execute_compiled(elem.compile(dialect=self.dialect,
> > > parameters=param), *multiparams, **params)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/engine/base.py',
> > > line 560 in execute_compiled
> > >   self._execute_raw(context)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/engine/base.py',
> > > line 573 in _execute_raw
> > >   self._execute(context)
> > > File 
> > > '/mnt/data/www/apps/inews2/wenv-inews/lib/python2.4/SQLAlchemy-0.3.7-py2.4.egg/sqlalchemy/engine/base.py',
> > > line 591 in _execute
> > >   raise exceptions.SQLError(context.statement, context.parameters, e)
> > > SQLError: (ReferenceError) weakly-referenced object no longer exists
> > > u'SELECT `IN_Incident`.is_type_other AS `IN_Incident_is_type_other`,
> > > `IN_Incident`.measure_shore AS `IN_Incident_measure_shore`,
> > > `IN_Incident`.ptl_search_min AS `IN_Incident_ptl_search_min`,
> > > `IN_Incident`.measure_burn AS `IN_Incident_measure_burn`,
> > > `IN_Incident`.actl_entered_max AS `IN_Incident_actl_entered_max`,
> > > `IN_Incident`.actl_search_min AS `IN_Incident_actl_search_min`,
> > > `IN_Incident`.is_type_drill AS `IN_Incident_is_type_drill`,
> > > `IN_Incident`.lead_ssc AS `IN_Incident_lead_ssc`,
> > > `IN_Incident`.measure_skim AS `IN_Incident_measure_skim`,
> > > `IN_Incident`.orr_id AS `IN_Incident_orr_id`, `IN_Incident`.jic AS
> > > `IN_Incident_jic`, `IN_Incident`.ptl_is_mass AS
> > > `IN_Incident_ptl_is_mass`, `IN_Incident`.actl_search_max AS
> > > `IN_Incident_actl_search_max`, `IN_Incident`.lon AS `IN_Incident_lon`,
> > > `IN_Incident`.notified_by AS `IN_Incident_notified_by`,
> > > `IN_Incident`.actl_entered_min AS `IN_Incident_actl_entered_min`,
> > > `IN_Incident`.location AS `IN_Incident_location`,
> > > `IN_Incident`.inews_date AS `IN_Incident_inews_date`,
> > > `IN_Incident`.ptl_search_max AS `IN_Incident_ptl_search_max`,
> > > `IN_Incident`.public_affairs_html AS
> > > `IN_Incident_public_affairs_html`, `IN_Incident`.cause AS
> > > `IN_Incident_cause`, `IN_Incident`.ptl_unit AS `IN_Incident_ptl_unit`,
> > > `IN_Incident`.noaa_divisions_involved AS
> > > `IN_Incident_noaa_divisions_involved`, `IN_Incident`.ptl_entered_max
> > > AS `IN_Incident_ptl_entered_max`, `IN_Incident`.description AS
> > > `IN_Incident_description`, `IN_Incident`.measure_bio AS
> > > `IN_Incident_measure_bio`, `IN_Incident`.is_type_oil AS
> > > `IN_Incident_is_type_oil`, `IN_Incident`.is_top AS
> > > `IN_Incident_is_top`, `IN_Incident`.actl_unit AS
> > > `IN_Incident_actl_unit`, `IN_Incident`.lat AS `IN_Incident_lat`,
> > > `IN_Incident`.is_type_ptl_bio AS `IN_Incident_is_type_ptl_bio`,
> > > `IN_Incident`.effort AS `IN_Incident_effort`,
> > > `IN_Incident`.measure_disperse AS `IN_Incident_measure_disperse`,
> > > `IN_Incident`.name AS `IN_Incident_name`, `IN_Incident`.commodity AS
> > > `IN_Incident_commodity`, `IN_Incident`.other_cause AS
> > > `IN_Incident_other_cause`, `IN_Incident`.is_type_ptl_oil AS
> > > `IN_Incident_is_type_ptl_oil`, `IN_Incident`.is_type_bio AS
> > > `IN_Incident_is_type_bio`, `IN_Incident`.actl_is_mass AS
> > > `IN_Incident_actl_is_mass`, `IN_Incident`.is_involve_dac AS
> > > `IN_Incident_is_involve_dac`, `IN_Incident`.ptl_entered_min AS
> > > `IN_Incident_ptl_entered_min` \nFROM `IN_Incident` \nWHERE
> > > `IN_Incident`.is_top ORDER BY inews_date DESC \n LIMIT 99 OFFSET 0' []
>
> > > --
> > > Mike Orr <[EMAIL PROTECTED]>
>
> --
> Mike Orr <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to