aiopg icon indicating copy to clipboard operation
aiopg copied to clipboard

maxsize=0 in create_pool raise TypeError

Open DeoLeung opened this issue 8 years ago • 5 comments

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

DeoLeung avatar Apr 27 '17 01:04 DeoLeung

Got the same problem using aiopg==0.13.2

zlietapki avatar Apr 11 '18 00:04 zlietapki

Got the same problem aiopg==0.16.0

EAdonyaeva avatar Nov 10 '19 09:11 EAdonyaeva

try updating to version aiopg==1.0.0

vir-mir avatar Nov 11 '19 10:11 vir-mir

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'

gmr avatar Apr 13 '20 18:04 gmr

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'

elemoine avatar Jun 08 '20 14:06 elemoine