shard tests are triggering a bus error on sqlite

Issue #1099 resolved
Mike Bayer repo owner created an issue

Reproduces regularly on my macbook pro. The actual "Bus error" occurs on line 149 of the shard.py test, this line of code:

        t = sess.query(WeatherLocation).get(tokyo.id)

and within that, specifically in query.py on line 1094, when it hits the "asia" shard:

                fetch = cursor.fetchall()

a bunch of previous queries in the test work fine. So something is happening to the sqlite connection on the "asia" engine.

Comments (4)

  1. Mike Bayer reporter

    also, as is frequently my observation with these errors, it's related to "yield". We had a recent change that changed instances() to iterate directly instead of calling from iterate_instances(). This patch "repairs" the issue (but of course breaks the iterative behavior of instances()):

    ===================================================================
    --- lib/sqlalchemy/orm/query.py (revision 4897)
    +++ lib/sqlalchemy/orm/query.py (working copy)
    @@ -1081,7 +1081,7 @@
                 labels = dict([property(util.itemgetter(i))) for i, label in enumerate(labels) if label]((label,))
                 rowtuple = type.__new__(type, "RowTuple", (tuple,), labels)
                 rowtuple.keys = labels.keys
    -            
    +        
             while True:
                 context.progress = util.Set()
                 context.partials = {}
    @@ -1114,11 +1114,12 @@
                 for ii, attrs in context.partials.items():
                     ii.commit(attrs)
    
    -            for row in rows:
    -                yield row
    +            return iter(rows)
    +#            for row in rows:
    +#                yield row
    
    -            if not self._yield_per:
    -                break
    +#            if not self._yield_per:
    +#                break
         iterate_instances = util.deprecated()(instances)
    
         def _get(self, key=None, ident=None, refresh_state=None, lockmode=None, only_load_props=None):
    
  2. Log in to comment