Connection pool breaks with classes created with #8934

yxhuvud opened this Issue Jan 14, 2013 · 7 comments

7 participants


retrieve_connection_pool in connection_pool.rb look up connection pool by class name. However, class name is the empty string if the class is created with If several classes are created that way using different databases, then massive confusion will occur.

I see two possible resolutions to this:
1: Enforce name being != "" when executing estrablish_connection
2: use object_id instead of class name.

Not the biggest issue I guess since it is quite a bit off the normal path of doing things, but it is still not very nice to get silent breakage.

Ruby on Rails member


@jonleighton @tenderlove is this a case we want to support?

Ruby on Rails member

We use the class name to avoid memory leaks in development mode. I guess a better solution would be to use ActionDispatch::Reloader to clear the cache of the connection handler.


I'm not sure we should be supporting "anonymous" AR classes since a sizable chunk of AR code depends on each class having a proper name (guessing table names, guessing and looking up relation classes, etc).

Ruby on Rails member

I agree with @thedarkone

Ruby on Rails member

Ya, let's not support anonymous classes for now. I will have people change this to raise an exception.

@tenderlove tenderlove was assigned Jan 19, 2013

As long as noone else has to to the error searching I had to do, I'm happy.

I'd prefer if it is kept at a simple check that .name isn't returning the empty string though, since that seems to be the only showstopper.

Ruby on Rails member

Closing this since #9002 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment