<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">QueuePool do_return_invalid needs to <em>always</em> decrement overflow, or eventually (assuming max_overflow &gt;= 0) you'll try to do a blocking get on an empty Queue, and hang.</p>
<p dir="auto">You can reproduce this with a DBProxy having a small pool_size, max_overflow=0, and just get a connection + invalidate it until you hang.</p>
<p dir="auto">It's more clear that "always decrement on invalidation" is the correct policy when you consider that pool_size + _overflow represents the number of created connections that will go back into the queue when released; an invalidated connection should thus always  result in _overflow -= 1.</p>
<p dir="auto"><strong>Migrated issue, originally created by Oleg Pidsadnyi (<a href="https://github.com/olegp">@olegp</a>)</strong></p>
<p dir="auto">Mike, I've encountered a behavior that is a bit unexpected:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class Model(Base):
    a = Column(Integer, nullable=True, default=1)

m = Model()
m.a = None
session.add(m)

In: print m.a
Out: None

session.commit()

In: print m.a
Out: 1
"><pre class="notranslate"><code class="notranslate">class Model(Base):
    a = Column(Integer, nullable=True, default=1)

m = Model()
m.a = None
session.add(m)

In: print m.a
Out: None

session.commit()

In: print m.a
Out: 1

</code></pre></div>
<p dir="auto">None is expected :(</p>
<p dir="auto">I understand that the configuration is silly, but this is the existing code. Setting None to the column doesn't cancel the default and the default thinks that the column wasn't set, so it uses the default value in the end.</p>