aiopg
aiopg copied to clipboard
maxsize=0 in create_pool raise TypeError
if I set maxsize=0 in create_pool, occasionally I got
Traceback (most recent call last):
File "/xxx/lib/python3.5/site-packages/tornado/web.py", line 1511, in _execute
result = yield result
File "/xxx/lib/python3.5/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/xxx/lib/python3.5/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/xxx/lib/python3.5/site-packages/tornado/gen.py", line 307, in wrapper
yielded = next(result)
File "<string>", line 6, in _wrap_awaitable
File "/yyy.py", line 34, in extract_pg
with (await pool.cursor(cursor_factory=cursor)) as cur:
File "/xxx/lib/python3.5/site-packages/aiopg/pool.py", line 263, in cursor
conn = yield from self.acquire()
File "/xxx/lib/python3.5/site-packages/aiopg/utils.py", line 67, in __iter__
resp = yield from self._coro
File "/xxx/lib/python3.5/site-packages/aiopg/pool.py", line 170, in _acquire
yield from self._fill_free_pool(True)
File "/xxx/lib/python3.5/site-packages/aiopg/pool.py", line 212, in _fill_free_pool
if override_min and self.size < self.maxsize:
TypeError: unorderable types: int() < NoneType()
using aiopg=0.13.0
Got the same problem using aiopg==0.13.2
Got the same problem aiopg==0.16.0
try updating to version aiopg==1.0.0
Same problem in aiopg==1.0.0 for me:
File "/Users/gavinr/Source/PSE/anabroker/env/lib/python3.7/site-packages/aiopg/utils.py", line 94, in __aenter__
self._obj = await self._coro
File "/Users/gavinr/Source/PSE/anabroker/env/lib/python3.7/site-packages/aiopg/pool.py", line 164, in _acquire
await self._fill_free_pool(True)
File "/Users/gavinr/Source/PSE/anabroker/env/lib/python3.7/site-packages/aiopg/pool.py", line 208, in _fill_free_pool
if override_min and self.size < self.maxsize:
TypeError: '<' not supported between instances of 'int' and 'NoneType'
Yep, in particular that problem occurs when the pool is created with minsize=0 and maxsize=0:
>>> pool = await aiopg.create_pool(dsn="", minsize=0, maxsize=0)
>>> await pool._fill_free_pool(True)
Traceback (most recent call last):
File "/usr/lib64/python3.8/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/usr/lib64/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "<console>", line 1, in <module>
File "/home/elemoine/.virtualenvs/procrastinate/lib/python3.8/site-packages/aiopg/pool.py", line 208, in _fill_free_pool
if override_min and self.size < self.maxsize:
TypeError: '<' not supported between instances of 'int' and 'NoneType'