#celery

/

      • hr
        in the result backend?
      • georgeirwin has quit
      • ionelmc
        asksol: could the broker connections could leave dangling references in the hub ?
      • asksol
        dangling?
      • hr: if you use redis/memcached yes
      • ionelmc
        yeah, the Channel or whatever closes connection but does not remove it from the hub
      • asksol
        hr: but obviously the count is correct what is missing is the results
      • ionelmc: that would be possible
      • ionelmc
        then there's another operation with the same fd that is something else (cause linux recycles them fds very fast) and gets closed erroneusly
      • i had this issue before
      • managed to segfault the interpreter by just mismanaging fds :)
      • asksol: any hints on where to look for this issue in the broker ?
      • i was using redis for broker
      • also, i was thinking, maybe the hub should log some error or raise one if you try to add a fd that's already in the hub - would raising break any existing code ?
      • asksol
        not sure, everything is in kombu.transport.redis
      • ionelmc
        i think that would *really* help tracking the source of the leak
      • asksol
        you would have to rewrite some parts in case
      • several things will replace the fd afair
      • e.g. from 'wait for outq readable' to 'read from outq'
      • I was considering the same, but matched what other event loops are doing
      • ionelmc
        well ok, lemme ask differently: is there any place now that will re-add a handler on a fd - with a *diffrent* callback ?
      • asksol
        also would like to register file objects instead of raw fds
      • but that is also tricky as I think select returns fds not the original objects
      • hr
        that's annoying ::/
      • asksol
        sure
      • ionelmc
        asksol: you can't ... you only get back numbers from epoll or whatever :(
      • hr
        asksol: any suggestion as to where I should look so I stop asking stupid questions ::p
      • asksol
        hr: maybe redis evicted them, this happens to me and nothing is logged
      • ionelmc
        asksol: so then, is there any place now that will re-add a handler on a fd - with a *diffrent* callback ?
      • negval has quit
      • asksol
        ionelmc: yes
      • ionelmc
        are there many situations like that?
      • hr
        why would that happen?
      • ionelmc
        can you give me some examples?
      • asksol
        I don't remember
      • hr
        any way to fix the timeout (if it would be the problem)
      • asksol
        <asksol> e.g. from 'wait for outq readable' to 'read from outq'
      • there will be many more in the future
      • negval joined the channel
      • ionelmc
        asksol: well yeah, but that's a larger change, and btw, not all event loops implement the reactor pattern
      • tulip does a proactor iirc
      • hr
        this is the only key I see in my redis celery-task-meta-a4cd6f41-e02f-4cb5-8fa7-fd2639cdb4a2
      • asksol
        hr: the timeout value is arbitrary, it shouldn't have to wait since the counter means all results should have been written
      • ionelmc
        asksol: can you give me a highlevel explanation of the `consolidation` thing in the Hub ?
      • is it something so you can have a 'bulk callback` - eg, there's a callback that get's called with all the fds that were ready in one poller poll ?
      • asksol
        ionelmc: that just means it will call a callback once for all fds instead of one callback for every fd
      • it's only used when the pool inqueues are readable
      • ionelmc
        and then you need to filter out what you're interested in in said callback
      • asksol
        as we need to choose one to write to
      • ionelmc
        right?
      • asksol
        right, but all callbacks that were flagged as 'consolidate'
      • ionelmc
        aah right
      • asksol
        it's only there for inqueue scheduling
      • so there is only one list of 'consolidate fds', you cannot have multiples
      • so it calls schedule_writes(list_of_inqueue_fds_ready_for_read)
      • instead of inqueue_ready(fd); inqueue_ready(fd); inqueue_ready(fd)
      • if did the latter we would have to maintain a set of ready fds and then hub.call_soon(schedule_writes())
      • avn
        asksol: Can you help me with hooking __call__ in Task? https://gist.github.com/avnik/8710313 I try different ways but them not works
      • asksol
        which we probably will need to when it's ported to tulip, but it's an optimiziation
      • btw, we could be proactive like by having a second dispatch in the hub for each fd
      • hr
        asksol: I also created that ticket about functools and autodoc
      • I
      • I'll dig in autodoc look at how it gets the signature and try to give better ideas
      • asksol
        avn: why does it not work?
      • hr: from proj.tasks import task; print(task.__doc__)
      • hr
        I'll explain the problem bette
      • asksol
        ionelmc: but I guess that would lead to ambiguity as to who will register the fd
      • or maybe not, the second 'read from outqueue' will already know that the fd is registered
      • samstav joined the channel
      • I had a hell of a time debugging that too, I logged every reregister though and worked my way backwards
      • ionelmc
        asksol: proactor pattern doesn't get you much if you need to do buffering to message boundary anyway
      • asksol
        problem is when you add too much logging the I/O slows it down and the race conditions disappear :)
      • ionelmc
        and i don't see you using windows IOCP in kombu's hub any time soon
      • at least not sooner than when you port to tulip :p
      • asksol
        right, but if we have a second list of callbacks we could raise an error if the fd is registered twice
      • ionelmc
        asksol: ok, so you've actually tried what i said (about doing that warning on re-add) ??
      • asksol
        yeah, in debugging but that will lead too many false positive warnings
      • ionelmc
        asksol: i'm gonna check if the callback is the same
      • should be less false positives :)
      • asksol
        right but moving from 'outqueue readable?' to 'outqueue read' happens for every task
      • I also checked if the callback.__name__ was the write_job or read from outqueue generators
      • vishesh is now known as trc
      • the generator api needs to change to something convenient, just too bad there is no yield_from
      • once we have a generator api that makes sense the redis transport could be much simpler too
      • the yield should be based on an operation, not yielding when the fd is unavailable
      • samstav has quit
      • Diranged joined the channel
      • that is my next task now as it coincides with the async pyamqp rewrite
      • ionelmc
        asksol: which one exactly?
      • you've lost me :P
      • dega has quit
      • bwreilly joined the channel
      • asksol
        pyamqp will be async, and I cannot manually write the read() and write() operations each time
      • so the generators used in the event loop now needs to change anyway
      • ionelmc
        so what do you plan to do with the hub ? make it proactor-like?
      • georgeirwin joined the channel
      • asksol
        well, I guess it will be like now but there must be a second layer
      • so the callback points to a object that controls what happens on a read/write/error event
      • bwreilly has quit
      • and the coroutines use data = yield read(size)
      • samstav joined the channel
      • the amqp protocol is more like a state machine so cannot unroll that into a single inlined generator :)
      • ionelmc
        asksol: would it be possible that redis.MultiChannelPoller would use the poller instance from the Hub ?
      • asksol
        isn't that what it does now?
      • ionelmc
        it does this in the __init__ meth: self.poller = poll()
      • but it would be possible to patch up that poller instance with the one from the Hub instance
      • i'm just asking if there's anything like that now
      • asksol
        see Transport.register_with_event_loop
      • ionelmc
        god damn it
      • def on_poll_init(self, poller):
      • self.poller = poller
      • asksol
        it should use the hub directly imho, and create a custom Hub object if used blocking
      • ionelmc
        :)
      • becks__ joined the channel
      • this will grant direct access to the poller
      • asksol
        currently it's just a hack to make it use the hub
      • ionelmc
        and create issues in the hub - cause the hub expects fds in the poll to also be in self.readers/writers
      • well, i put my money on this as the cause for the fd issues
      • not all my money tho ... ;p
      • asksol
        hmm, that is not unlikely
      • it should use the hub api directly and create a private Hub instance if there isn't one
      • would simplify the code a bit too I would think
      • ionelmc
        is it possible that the channel is not closed ?
      • but it's actually long-dead-and-burried
      • asksol
        the redis transport isn't async
      • it just uses select to know what channel to read from
      • note that channel here means a redis connection
      • so every time it needs a message it sends BRPOP + LISTEN operations
      • when the channel is closed it cancels the operation and remove the fd from the poller
      • removes*
      • avn
        asksol: incorrect self if decorator used, variant with super(MyTask, self).__call__(...) give regression in tasks with progress updates
      • ionelmc
        ok, but is it possible that the channel is not closed ?
      • where would I look ?
      • asksol
        the channel should never close unless there is a connection failure
      • georgeirwin has quit
      • you would just add a print statement to wherever you expect the fd to be unregistered
      • Nizumzen has quit
      • avn
        asksol: File "/home/avn/work/sandbox/apu/eggs/celery-3.1.8-py2.7.egg/celery/backends/base.py", line 379, in get_key_for_task
      • return self.task_keyprefix + self.key_t(task_id)
      • TypeError: cannot concatenate 'str' and 'NoneType' objects
      • (I hope pasting three lines not against rules of channel?)
      • asksol
        avn: __call__ is a bound method when you try to decorate it, you should use inheritance
      • rcleere joined the channel
      • samstav has quit
      • avn
        asksol: I have this error in case of def __call__(self, *a, **kw): return super(MyTask, self).__call__(*a, **kw)
      • bwreilly joined the channel
      • bkuberek has quit
      • bkuberek joined the channel
      • samstav joined the channel
      • georgeirwin joined the channel