Comments (19)
Are you sure that error is generated by aiopg
?
Looks like I've got error from transport but aiopg doesn't use asyncio
transports at all.
P.S. Please don't use global variables, push aoipg pool into aiohttp.web.Application
:
app = aiohttp.web.Application(...)
app['pgpool'] = yield from aiopg.create_pool(...)
in request handler
def handler(request):
pool = request.app['pgpool']
from aiopg.
The http requests that do not depend on database work perfectly fine.
I will try your suggestion. However, why should declaring a global variable be an issue in the first place though?
from aiopg.
No, global variables are not related to your issue.
But as far as I see you exception traceback is not related to aiopg.
from aiopg.
I have a similar situation. The process works great for extended periods of time, but then suddenly the database connection stops working. In my log I see only the following:
2015-09-24 02:04:31,841 asyncio ERROR Fatal error on aiopg connection: bad state in _ready callback
I'm giong to be trying to add more error recovery and logging code, so if I learn anything more I'll update.
from aiopg.
By the way, I get 10 copies of that message in my log one right after the other. I presume it is one for each connection in the pool.
from aiopg.
Is any way to reproduce this? We had similar issue with aiomysql due to MySQL server connection timeout, successfully fixed in aio-libs/aiomysql#27
from aiopg.
I don't have a reproducer yet, but the data I have so far indicates it is probably a result of a timeout on the DB connection. I'm planning to try to create a reproducer once I have more data.
from aiopg.
My case appears to be a consequence of #65. The reproducer in that issue produces the same kind of traceback that I'm seeing in my applicaion, which I now catch and ignore. Then 30 seconds later I get the bad state in _ready.
I'll investigate fixing this, but it will probably be a week or more before I can circle back to this problem.
from aiopg.
@asvetlov i was able to reproduce this scenario and basically it was due to timeoutError.
i just ran my test cases on your recent commits and issue no longer exists.
but there is a suggestion https://github.com/aio-libs/aiopg/blob/master/aiopg/connection.py#L182 could you make it to execute in asyncio.sheild() and change cancel() method accordingly, atleast in this case it will ensure that future gets executed properly even if timeout or cancelledError occurs
from aiopg.
@pankajnits thanks for good news!
I don't follow your suggestion, sorry.
Cancellation is already executed under the shield.
Waiting for future object doesn't require shielding, isn't it?
from aiopg.
@asvetlov its good that cancel is ensured , but out of curiosity i wanted to ask that what if we can ensure future is shielded irrespective of timeouts.
from aiopg.
also will it help in solving #65
from aiopg.
in case of waiter being timedout and scheduled for cancellation, i can see that there are queries in postgres db that are in "idle" state
from aiopg.
Simulate load error. The error manifests itself only when the load increases.
https://gist.github.com/DevSpouk/92a51f2bffb5f6f67352
from aiopg.
I've the same issue with a big load when I launch a benchmark on any project based on aiopg.
from aiopg.
If somebody has a solution for that, I'm interested in, I'm working for the round 12 of FrameworkBenchmarks.
If I've a solution before Jan 9, I'll push the solution for the round 12.
After, it will be the next round, except if they add more delay.
from aiopg.
Is this issue still present? We've been looking for an asynchronous wrapper for Postgres access, but this would probably be a show-stopper.
from aiopg.
Looks like this issue was fixed. @asvetlov could you confirm?
from aiopg.
I believe we we have solved the issue.
from aiopg.
Related Issues (20)
- Task is getting canceled
- aiopg 1.1.0+ is incompatible with SQLAlchemy 1.4 HOT 23
- Cursor.execute() freezes + Pool.wait_closed() blocks after Pool.close() HOT 2
- aiopg1.2 incompatible with peewee-async HOT 1
- executing a query on a closed SAConnection throws a non-indicative exception HOT 2
- Update "table" with inverse (logic) doesn't work
- FileNotFoundError when connecting to postgres if fd is closed and then reopened HOT 6
- Replace dependency psycopg2-binary with psycopg2 HOT 1
- unable to perform operation on <UVPoll closed=True 0x7fe55db27270>; the handler is closed
- Incompatibility with SQLAlchemy 1.4
- SAConnection twophase methods are broken
- Roadmap after psycopg3 release HOT 2
- Incompatible with SQLAlchemy 1.4.38 and higher HOT 7
- AttributeError: 'Connection' object has no attribute 'send' HOT 1
- Incompatible with SQLAlchemy 2.0.0 HOT 7
- 1.4.0: documentation cannot be build using latest sphinx
- Sometimes got error
- Allow just-in-time compution of credentials for new connections in a pool
- Let's put `aiopg` under the `aio-libs` org on PyPI HOT 3
- NotImplementedError 😢
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiopg.