cloud-sql-python-connector icon indicating copy to clipboard operation
cloud-sql-python-connector copied to clipboard

Is pypy supported?

Open Rossco8 opened this issue 3 years ago • 1 comments

Question - Is cloud-sql-python-connector supported in a pypy runtime?

I'm seeing regular errors (eg 90% of the time) when the 'Requesting ephemeral certificate' runs.

2022-09-02T05:37:16.155338489ZTraceback (most recent call last): File "/opt/pypy/lib/pypy3.9/asyncio/tasks.py", line 258, in __step 
result = coro.throw(exc) File "/opt/pypy/lib/pypy3.9/site-packages/google/cloud/sql/connector/refresh_utils.py", line 176, in _get_ephemeral resp = await client_session.post( File "/opt/pypy/lib/pypy3.9/site-packages/aiohttp/client.py", line 535, in _request 
conn = await self._connector.connect( File "/opt/pypy/lib/pypy3.9/site-packages/aiohttp/connector.py", line 542, in connect proto = await self._create_connection(req, traces, timeout) File "/opt/pypy/lib/pypy3.9/site-packages/aiohttp/connector.py", line 907, in 
_create_connection _, proto = await self._create_direct_connection(req, traces, timeout) File "/opt/pypy/lib/pypy3.9/site-
packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File 
"/opt/pypy/lib/pypy3.9/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/opt/pypy/lib/pypy3.9/asyncio/base_events.py", 
line 1050, in create_connection sock = await self._connect_sock( File "/opt/pypy/lib/pypy3.9/asyncio/base_events.py", line 961, in _connect_sock await self.sock_connect(sock, address) File "/opt/pypy/lib/pypy3.9/asyncio/selector_events.py", line 499, in 
sock_connect return await fut File "/opt/pypy/lib/pypy3.9/asyncio/futures.py", line 284, in __await__ yield self # This tells Task to wait for completion. File "/opt/pypy/lib/pypy3.9/asyncio/tasks.py", line 328, in __wakeup future.result() File 

"/opt/pypy/lib/pypy3.9/asyncio/futures.py", line 196, in result raise exc

Then

2022-09-02T05:37:16.155571559Zasyncio.exceptions.CancelledError

It does randomly occasionally work

Rossco8 avatar Sep 02 '22 05:09 Rossco8

Hi @Rossco8, thanks for asking a great question and using the Cloud SQL Python Connector!

We don't officially claim to support pypy as we don't have any tests in our CI currently that test against it.

With that being said, using pyenv on Linux and installing the environment pypy3.8-7.3.7, I was able to successfully use the Python Connector without seeing the same errors as you.

Are you able to provide more details surrounding your OS and pypy versions? Might also be beneficial to me if you are able to provide your application code for me to take a look at. Happy to try and help debug this for you :)

Otherwise, we can also turn this issue into a feature request along the lines of Add support and tests for pypy environment so that I can plan work to add official tests against pypy.

Have an awesome day!

-- Jack

jackwotherspoon avatar Sep 02 '22 14:09 jackwotherspoon

I'm attempting to put together a minimal reproducible example to demonstrate the problem, hopefully not much longer

Rossco8 avatar Sep 07 '22 01:09 Rossco8

@Rossco8 that would be awesome and much appreciated. I will look at maybe turning this issue into a feature request to at-least add testing in our CI against pypy at the very least.

jackwotherspoon avatar Sep 09 '22 15:09 jackwotherspoon

@Rossco8 from running tests against pypy3.9 in our CI #465 , it seems that pypy is supported with the Python Connector for pg8000, pymysql and pytds drivers. (not supported for asyncpg because it uses C-API extensions)

Let me know if this helps answer your question.

jackwotherspoon avatar Sep 09 '22 16:09 jackwotherspoon

Closing this out, see previous comment for details. Feel free to re-open the issue if you have extra details or further questions involving pypy.

jackwotherspoon avatar Sep 13 '22 19:09 jackwotherspoon

I can re-produce this problem and it is not related to PyPy. I'll open a new issue for it

Rossco8 avatar Sep 14 '22 03:09 Rossco8