long2ice / asyncmy

A fast asyncio MySQL/MariaDB driver with replication protocol support
https://github.com/long2ice/asyncmy
Apache License 2.0
264 stars 32 forks source link

Test failures and errors on 32-bit platforms #34

Open musicinmybrain opened 2 years ago

musicinmybrain commented 2 years ago

Is asyncmy intentionally 64-bit-only? I encounter a number of test failures and errors on 32-bit platforms (i686 or armv7hl/armhfp).

============================= test session starts ==============================
platform linux -- Python 3.10.1, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /builddir/build/BUILD/asyncmy-0.2.3
plugins: asyncio-0.14.0
collected 13 items
tests/test_autocommit.py .                                               [  7%]
tests/test_connection.py ..                                              [ 23%]
tests/test_cursor.py ...FEEE                                             [ 76%]
tests/test_pool.py EEEE                                                  [100%]
==================================== ERRORS ====================================
________________________ ERROR at setup of test_delete _________________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
args = ()
kwargs = {'connection': <asyncmy.connection.Connection object at 0xf6573cb8>}
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
setup = <function pytest_fixture_setup.<locals>.wrapper.<locals>.setup at 0xf652a2f8>
    def wrapper(*args, **kwargs):
        loop = fixture_stripper.get_and_strip_from(FixtureStripper.EVENT_LOOP, kwargs)

        async def setup():
            res = await coro(*args, **kwargs)
            return res

>       return loop.run_until_complete(setup())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:140: in setup
    res = await coro(*args, **kwargs)
conftest.py:61: in truncate_table
    await cursor.execute("truncate table test.asyncmy")
asyncmy/cursors.pyx:180: in execute
    ???
asyncmy/cursors.pyx:365: in _query
    ???
asyncmy/connection.pyx:455: in query
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
______________________ ERROR at setup of test_executemany ______________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
args = ()
kwargs = {'connection': <asyncmy.connection.Connection object at 0xf6573cb8>}
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
setup = <function pytest_fixture_setup.<locals>.wrapper.<locals>.setup at 0xf64dbd60>
    def wrapper(*args, **kwargs):
        loop = fixture_stripper.get_and_strip_from(FixtureStripper.EVENT_LOOP, kwargs)

        async def setup():
            res = await coro(*args, **kwargs)
            return res

>       return loop.run_until_complete(setup())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:140: in setup
    res = await coro(*args, **kwargs)
conftest.py:61: in truncate_table
    await cursor.execute("truncate table test.asyncmy")
asyncmy/cursors.pyx:180: in execute
    ???
asyncmy/cursors.pyx:365: in _query
    ???
asyncmy/connection.pyx:455: in query
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
_______________________ ERROR at setup of test_table_ddl _______________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
args = ()
kwargs = {'connection': <asyncmy.connection.Connection object at 0xf6573cb8>}
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
setup = <function pytest_fixture_setup.<locals>.wrapper.<locals>.setup at 0xf64e9bb0>
    def wrapper(*args, **kwargs):
        loop = fixture_stripper.get_and_strip_from(FixtureStripper.EVENT_LOOP, kwargs)

        async def setup():
            res = await coro(*args, **kwargs)
            return res

>       return loop.run_until_complete(setup())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:140: in setup
    res = await coro(*args, **kwargs)
conftest.py:61: in truncate_table
    await cursor.execute("truncate table test.asyncmy")
asyncmy/cursors.pyx:180: in execute
    ???
asyncmy/cursors.pyx:365: in _query
    ???
asyncmy/connection.pyx:455: in query
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
_________________________ ERROR at setup of test_pool __________________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
args = ()
kwargs = {'connection': <asyncmy.connection.Connection object at 0xf6573cb8>}
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
setup = <function pytest_fixture_setup.<locals>.wrapper.<locals>.setup at 0xf64e9460>
    def wrapper(*args, **kwargs):
        loop = fixture_stripper.get_and_strip_from(FixtureStripper.EVENT_LOOP, kwargs)

        async def setup():
            res = await coro(*args, **kwargs)
            return res

>       return loop.run_until_complete(setup())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:140: in setup
    res = await coro(*args, **kwargs)
conftest.py:61: in truncate_table
    await cursor.execute("truncate table test.asyncmy")
asyncmy/cursors.pyx:180: in execute
    ???
asyncmy/cursors.pyx:365: in _query
    ???
asyncmy/connection.pyx:455: in query
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
______________________ ERROR at setup of test_pool_cursor ______________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
args = ()
kwargs = {'connection': <asyncmy.connection.Connection object at 0xf6573cb8>}
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
setup = <function pytest_fixture_setup.<locals>.wrapper.<locals>.setup at 0xf7528418>
    def wrapper(*args, **kwargs):
        loop = fixture_stripper.get_and_strip_from(FixtureStripper.EVENT_LOOP, kwargs)

        async def setup():
            res = await coro(*args, **kwargs)
            return res

>       return loop.run_until_complete(setup())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:140: in setup
    res = await coro(*args, **kwargs)
conftest.py:61: in truncate_table
    await cursor.execute("truncate table test.asyncmy")
asyncmy/cursors.pyx:180: in execute
    ???
asyncmy/cursors.pyx:365: in _query
    ???
asyncmy/connection.pyx:455: in query
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
------------------------------ Captured log setup ------------------------------
WARNING  asyncio:selector_events.py:911 socket.send() raised exception.
________________________ ERROR at setup of test_acquire ________________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
>           raise self._exception
/usr/lib/python3.10/asyncio/streams.py:697: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
args = ()
kwargs = {'connection': <asyncmy.connection.Connection object at 0xf6573cb8>}
loop = <_UnixSelectorEventLoop running=False closed=False debug=False>
setup = <function pytest_fixture_setup.<locals>.wrapper.<locals>.setup at 0xf650ad60>
    def wrapper(*args, **kwargs):
        loop = fixture_stripper.get_and_strip_from(FixtureStripper.EVENT_LOOP, kwargs)

        async def setup():
            res = await coro(*args, **kwargs)
            return res

>       return loop.run_until_complete(setup())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:140: in setup
    res = await coro(*args, **kwargs)
conftest.py:61: in truncate_table
    await cursor.execute("truncate table test.asyncmy")
asyncmy/cursors.pyx:180: in execute
    ???
asyncmy/cursors.pyx:365: in _query
    ???
asyncmy/connection.pyx:455: in query
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
------------------------------ Captured log setup ------------------------------
WARNING  asyncio:selector_events.py:911 socket.send() raised exception.
______________________ ERROR at teardown of test_acquire _______________________
    def finalizer():
        """Yield again, to finalize."""
        async def async_finalizer():
            try:
                await gen_obj.__anext__()
            except StopAsyncIteration:
                pass
            else:
                msg = "Async generator fixture didn't stop."
                msg += "Yield only once."
                raise ValueError(msg)
>       loop.run_until_complete(async_finalizer())
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
/usr/lib/python3.10/site-packages/pytest_asyncio/plugin.py:117: in async_finalizer
    await gen_obj.__anext__()
conftest.py:36: in connection
    await conn.ensure_closed()
asyncmy/connection.pyx:320: in ensure_closed
    ???
/usr/lib/python3.10/asyncio/streams.py:360: in drain
    raise exc
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:697: in readexactly
    raise self._exception
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:697: in readexactly
    raise self._exception
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:697: in readexactly
    raise self._exception
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:697: in readexactly
    raise self._exception
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:697: in readexactly
    raise self._exception
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:697: in readexactly
    raise self._exception
asyncmy/connection.pyx:610: in asyncmy.connection.Connection._read_bytes
    ???
/usr/lib/python3.10/asyncio/streams.py:708: in readexactly
    await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:502: in _wait_for_data
    await self._waiter
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
------------------------------ Captured log setup ------------------------------
WARNING  asyncio:selector_events.py:911 socket.send() raised exception.
---------------------------- Captured log teardown -----------------------------
WARNING  asyncio:selector_events.py:911 socket.send() raised exception.
=================================== FAILURES ===================================
_________________________________ test_insert __________________________________
>   ???
asyncmy/connection.pyx:610: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
n = 4
    async def readexactly(self, n):
        """Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        """
        if n < 0:
            raise ValueError('readexactly size can not be less than zero')

        if self._exception is not None:
            raise self._exception

        if n == 0:
            return b''

        while len(self._buffer) < n:
            if self._eof:
                incomplete = bytes(self._buffer)
                self._buffer.clear()
                raise exceptions.IncompleteReadError(incomplete, n)

>           await self._wait_for_data('readexactly')
/usr/lib/python3.10/asyncio/streams.py:708: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <StreamReader exception=ConnectionResetError(104, 'Connection reset by peer') transport=<_SelectorSocketTransport closed fd=14>>
func_name = 'readexactly'
    async def _wait_for_data(self, func_name):
        """Wait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        """
        # StreamReader uses a future to link the protocol feed_data() method
        # to a read coroutine. Running two read coroutines at the same time
        # would have an unexpected behaviour. It would not possible to know
        # which coroutine would get the next data.
        if self._waiter is not None:
            raise RuntimeError(
                f'{func_name}() called while another coroutine is '
                f'already waiting for incoming data')

        assert not self._eof, '_wait_for_data after EOF'

        # Waiting for data while paused will make deadlock, so prevent it.
        # This is essential for readexactly(n) for case when n > self._limit.
        if self._paused:
            self._paused = False
            self._transport.resume_reading()

        self._waiter = self._loop.create_future()
        try:
>           await self._waiter
/usr/lib/python3.10/asyncio/streams.py:502: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <_SelectorSocketTransport closed fd=14>
    def _read_ready__data_received(self):
        if self._conn_lost:
            return
        try:
>           data = self._sock.recv(self.max_size)
E           ConnectionResetError: [Errno 104] Connection reset by peer
/usr/lib/python3.10/asyncio/selector_events.py:856: ConnectionResetError
During handling of the above exception, another exception occurred:
connection = <asyncmy.connection.Connection object at 0xf6573cb8>
    @pytest.mark.asyncio
    async def test_insert(connection):
>       async with connection.cursor(cursor=DictCursor) as cursor:
tests/test_cursor.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
asyncmy/cursors.pyx:76: in __aexit__
    ???
asyncmy/cursors.pyx:64: in close
    ???
asyncmy/cursors.pyx:118: in nextset
    ???
asyncmy/cursors.pyx:113: in _nextset
    ???
asyncmy/connection.pyx:459: in next_result
    ???
asyncmy/connection.pyx:636: in _read_query_result
    ???
asyncmy/connection.pyx:1023: in read
    ???
asyncmy/connection.pyx:578: in read_packet
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
>   ???
E   asyncmy.errors.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)')
asyncmy/connection.pyx:612: OperationalError
----------------------------- Captured stderr call -----------------------------
OverflowError: Python int too large to convert to C unsigned long
=============================== warnings summary ===============================
tests/test_autocommit.py::test_autocommit
  /usr/lib/python3.10/asyncio/base_events.py:1881: Warning: Can't create database 'test'; database exists
    handle._run()
tests/test_cursor.py::test_insert
  /usr/lib/python3.10/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: 'asyncmy.protocol.MysqlPacket.read_uint64'

  Traceback (most recent call last):
    File "/builddir/build/BUILD/asyncmy-0.2.3/tests/test_cursor.py", line 33, in test_insert
      rows = await cursor.execute(
  OverflowError: Python int too large to convert to C unsigned long

    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_cursor.py::test_insert - asyncmy.errors.OperationalError: (...
ERROR tests/test_cursor.py::test_delete - asyncmy.errors.OperationalError: (2...
ERROR tests/test_cursor.py::test_executemany - asyncmy.errors.OperationalErro...
ERROR tests/test_cursor.py::test_table_ddl - asyncmy.errors.OperationalError:...
ERROR tests/test_pool.py::test_pool - asyncmy.errors.OperationalError: (2013,...
ERROR tests/test_pool.py::test_pool_cursor - asyncmy.errors.OperationalError:...
ERROR tests/test_pool.py::test_acquire - asyncmy.errors.OperationalError: (20...
ERROR tests/test_pool.py::test_acquire - ConnectionResetError: [Errno 104] Co...
======= 1 failed, 6 passed, 2 warnings, 7 errors in 28801.09s (8:00:01) ========
long2ice commented 2 years ago

Did not test in 32 bit system