bibanon / eve

Asagi replacement written in Python
16 stars 3 forks source link

Check to see if Eve works under PyPy #20

Open AGSPhoenix opened 5 years ago

AGSPhoenix commented 5 years ago

mysqlclient might need to be replaced with PyMySQL

AGSPhoenix commented 5 years ago

import_patched doesn't seem to work for pymysql with a db_pool. The first query to the DB just returns this traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Phoenix\Downloads\pypy3.6-v7.1.1-win32\lib-python\3\contextlib.py", line 82, in __enter__
    return next(self.gen)
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\db_pool.py", line 245, in item
    conn = self.get()
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\db_pool.py", line 176, in get
    conn = super(BaseConnectionPool, self).get()
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\pools.py", line 88, in get
    created = self.create()
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\db_pool.py", line 276, in create
    self._db_module, self.connect_timeout, *self._args, **self._kwargs)
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\db_pool.py", line 283, in connect
    conn = tpool.execute(db_module.connect, *args, **kw)
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\tpool.py", line 125, in execute
    six.reraise(c, e, tb)
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\support\six.py", line 689, in reraise
    raise value
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\eventlet\tpool.py", line 83, in tworker
    rv = meth(*args, **kwargs)
  File "C:\Users\Phoenix\Documents\eve\pypy-test\site-packages\pymysql\__init__.py", line 93, in Connect
    from .connections import Connection
SystemError: Parent module 'pymysql' not loaded, cannot perform relative import

Looks like eventlet/eventlet#81 from 5 years ago(!). Explicitly adding the module to sys.modules makes it work.

Performance is terrible while fetching new threads; as a hunch, I'd say it's taking a long time to compare each post against the in-memory version.

After running for ~150 seconds or so, inserts seem to stall, and I have no idea why. Seems to happen randomly on one of the calls to execute() or commit().

AGSPhoenix commented 5 years ago

pymysql works fine under CPython. Tried to test mysqlclient under PyPy (which is supported, supposedly) but it wants MySQL development sources and 5 GB of Visual C++ to compile, and fuck that.

Should check Linux where compilers are more sane.