-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query returns result from another query #88
Comments
Could you show how is your query look like? Do you have |
Yes, i use app['db_pool'] = loop.run_until_complete(
aiomysql.create_pool(
host='127.0.0.1', port=3306,
user=settings['db_user'],
password=settings['db_pass'],
db=settings['db_name'],
autocommit=True,
loop=loop
)
) Well queries are simple and could be as follow:
So when the result of (1) is returned as the result for (2) when i try to access 3-d field - there is an index out of bounds error. In the case when result for (2) is returned from another (2) there are no errors but we have wrong data for given id. Actually to determine this situation i added some extra code which compared id from result with id from where clause and if they were not equal i just logged that. And such records did appeared in log. |
To clerify there is |
Interesting, could you try execute tests with master? Is it somehow related to |
I looked through the code of aiomysql and it seems to me i found a possible reason of the issue. Here is a piece of code from file def acquire(self):
"""Acquire free connection from the pool."""
coro = self._acquire()
return _PoolAcquireContextManager(coro, self)
def _acquire(self):
if self._closing:
raise RuntimeError("Cannot acquire connection after closing pool")
with (yield from self._cond):
while True:
yield from self._fill_free_pool(True)
if self._free:
conn = self._free.popleft()
assert not conn.closed, conn
assert conn not in self._used, (conn, self._used)
self._used.add(conn)
return conn
else:
yield from self._cond.wait() A private |
This is not a problem, asyncio works fine without decorator. I am updating aiomysql to work with new version of PyMySQL, hopefully that will fix an issue. Could you provide minimal reproducible example so i can debug locally? |
Yes, it seems you are right.
I will try a new version. Hope it'll help. |
got it, there is patch with fix here #79 , I will apply it very soon. |
should be fixed in master |
new version released to pypi |
Hey I have the same error. Could you explain me how to fix it? I am using version 0.1.0 from aiomysql |
Hi @Vinc135, you're probably seeing a different issue. Please raise a new issue with your problem. |
Probably not but I downgraded the version and now the error is gone |
While it may very well be a regression with the same root cause, this issue has been resolved back in 2016. If you're seeing the same problem on 0.1.0 please report it as a new issue. Without any additional information I'm afraid I can't help you. |
I reported the error in a new issue. Can you help me there? |
The same problem appeared on 0.1.1. I use one cursor for all requests |
Here is my problem. I use aiomysql in aiohttp handlers. Something like this:
And some times rows are not the result for the given query q but the result from other query. There are no errors. It just silently returns wrong result. The only way i could determine that situation was that queries had different number of fields so there was an index out of bounds error in the log some times.
So the question is - do i run it in a right way? Or should i use any locks somewhere? Or is it a bug in the library?
The text was updated successfully, but these errors were encountered: