Comments (7)
I suspect problem in handling redis connections. Have you tried to place debugger in handlers?
from aiohttp-sse.
Yeah. On the subscribe function, there is a print statement that says ‘new sub.’ However, when the connection begins to timeout after 7-8 requests, it never prints ‘new sub’ which means the request isn’t even hitting the subscribe function. Thus, it is hard for me to believe that it could be a problem with redis.
from aiohttp-sse.
You need to identify actual point where handler hangs, that print shows only that aiohttp starts actually execution.
I can only guess where is problem (since no full source code is present). I suspect that datastore.Datastore.redis_pool.acquire()
never returns because no free redis connections in the pool. Anyway you need to refactor that code to guarantee that connection always released, otherwise it leaks connections in case of errors.
from aiohttp-sse.
here is the datastore.py file
import aioredis
import aiomcache
import asyncio
class Datastore:
@classmethod
async def setup(self, loop):
self.redis_pool = await aioredis.create_pool('redis://localhost', minsize = 35, maxsize = 40)
self.redis_pub = await aioredis.create_redis('redis://localhost')
#self.redissub = await aioredis.create_redis('redis://localhost')
self.mc = aiomcache.Client('127.0.0.1', 11211, loop = loop)
I just upped the pool connection size to 35 (from 4) and the problem is still occurring. I don't think redis is the problem — after about 8 connections, it doesn't even REACH the subscribe function, let alone the redis_pool.acquire()
statement. I know this because the print statement (which is before the redis_pool.acquire()
) isn't even run.
Plus, after about 8ish connections the other static pages (pubPage and subPage functions) do not work either. I just get a timeout.
from aiohttp-sse.
Ok. I just tested the following subscribe code, and the problem is still occurring — the problem is definitely not redis.
async def subscribe(request):
print('new sub')
async with sse_response(request) as resp:
await asyncio.sleep(1)
await resp.send('hello')
await asyncio.sleep(4)
await resp.send('hello')
await asyncio.sleep(8)
await resp.send('hello')
return resp
After six connections (and exactly six every single time), all calls to the server (whether they be sse or a static file) are timeout-ed.
Is there some config file that I need to change to allow for more than six connections?
from aiohttp-sse.
Ah looks like I see the problem, you are trying to connect form same browser? If so it is max number connections per domain limitation. Try several browsers.
from aiohttp-sse.
from aiohttp-sse.
Related Issues (20)
- Deprecation warning HOT 1
- Dependabot couldn't authenticate with https://pypi.python.org/simple/
- Invalid event stream format for multiline data HOT 3
- [BUG] Python 3.10: TypeError: sleep() got an unexpected keyword argument 'loop' HOT 4
- Switch to GitHub Actions HOT 1
- How it exits from handler? HOT 3
- Expose internal _ping_task's state or provide a way to notify handler that client connection is closed
- will this support post method? HOT 6
- Let's put `aiohttp-sse` under the `aio-libs` org on PyPI
- Loop property is deprecated
- Graceful example worked fails on browser reconnect
- Typing HOT 1
- Accept `float` type for ping interval value
- Remove self-made runner from tests
- Cancel ping_task on connection failure while sending event
- Don't swallow asyncio.CancelledError HOT 2
- Changelog watcher HOT 1
- Coverage config incompatible with pyCharm HOT 3
- 'EventSourceResponse' object has no attribute 'is_connected' HOT 3
- Integrating aiohttp-sse with Dash EventSource HOT 4
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 aiohttp-sse.