Dear All

I'm having a very strange issue with Sessions that I'm hoping someone can
guide me on;

I have a situation where a large body of code spawns new processes
(multiprocessing.process).  The core design manages 3 (possible) database
connections, and I've used a unique session for each.  The session is create
thus within the new process (i.e. not handed in)

Session = sessionmaker()    #  This is global

class myManager(object):
    # I use a manager class to manage the engines, MetaData and Sessions of
the 3 possible DB's   I create new sessions in here like this

      self.session1 = Session(bind = engine1)
      self.session2 = Session(bind = engine2)
      self.session3 = Session(bind = engine3)

All this works fine and all testing up to this point has been perfect.  Now,
when I start to load test and create more than one concurrent process, I'm
getting some form of corruption of my connections to the Database
(mysql+mysqlconnector) !?

All NON session based access to the server still work, but after I start the
second process, BOTH processes lost the ability to use the sessions create
(ones that where running and working stop immediately the second process
starts) with this;

(InterfaceError) 2055: Lost connection to MySQL server at '192.168.50.2:3306',
system error: 10054 u'SELECT products......

The connection is NOT lost really, as I can still do NON session based
queries using the same engine that the session is bound to.

As far as I can see, since the code is running in a completely different
process, how can they be interacting with each other and breaking the
connection to mySQL?

I've tried using scoped_session but could not work out how to have the 3
sessions as above all in the same context - so gave up.   As far as I can
see though on my limited understanding of the Session process, I have
isolated everything so there should be no issues.

Any ideas?

Cheers
Warwick

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

Reply via email to