]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
remove "aliased class pool" caching approach
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 13 May 2023 03:42:09 +0000 (23:42 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 13 May 2023 14:59:16 +0000 (10:59 -0400)
commit4b37ded2897c3ae9384ecdd6209699a0fdc513a3
treefced3c194d055bc97c86f6ab039f1e63f1372937
parenteb286c15f096771dbb128acbe8fe03e94aa72f6a
remove "aliased class pool" caching approach

Modified the ``JoinedLoader`` implementation to use a simpler approach in
one particular area where it previously used a cached structure that would
be shared among threads. The rationale is to avoid a potential race
condition which is suspected of being the cause of a particular crash
that's been reported multiple times. The cached structure in question is
still ultimately "cached" via the compiled SQL cache, so a performance
degradation is not anticipated.

The change also modifies the tests for None in context.secondary
to ensure no None values are in this list, as this is suspected
as being the immediate cause of the issue in #9777.  The cached
AliasedClass thing is suspected as being the origination of the
cause, as under high concurrency many threads might all access
that AliasedClass immediately, which seems a reasonable place
that the "adapter returning None" symptom might be originating.

As of yet we don't have a self-contained reproducer for the
issue, some initial attempts with threads are not showing any
issue.

Fixes: #9777
Change-Id: I967588f280796c413e629b55b8d97d40c1164248
doc/build/changelog/unreleased_20/9777.rst [new file with mode: 0644]
lib/sqlalchemy/orm/strategies.py
test/orm/test_options.py