GithubHelp home page GithubHelp logo

Comments (7)

jettify avatar jettify commented on May 21, 2024

I suspect problem in handling redis connections. Have you tried to place debugger in handlers?

from aiohttp-sse.

arjunpat avatar arjunpat commented on May 21, 2024

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.

jettify avatar jettify commented on May 21, 2024

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.

arjunpat avatar arjunpat commented on May 21, 2024

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.

arjunpat avatar arjunpat commented on May 21, 2024

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.

jettify avatar jettify commented on May 21, 2024

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.

jettify avatar jettify commented on May 21, 2024

see also https://docs.pushtechnology.com/cloud/latest/manual/html/designguide/solution/support/connection_limitations.html

from aiohttp-sse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.