Skip to content
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

asyncore loop lacks timers and work tasks #46290

Closed
janssen mannequin opened this issue Feb 4, 2008 · 12 comments
Closed

asyncore loop lacks timers and work tasks #46290

janssen mannequin opened this issue Feb 4, 2008 · 12 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@janssen
Copy link
Mannequin

janssen mannequin commented Feb 4, 2008

BPO 2006
Nosy @facundobatista, @josiahcarlson, @giampaolo, @tiran, @intgr
Files
  • unnamed
  • unnamed
  • unnamed
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2008-02-14.16:39:22.436>
    created_at = <Date 2008-02-04.05:52:01.706>
    labels = ['type-bug', 'library']
    title = 'asyncore loop lacks timers and work tasks'
    updated_at = <Date 2009-03-25.05:57:00.341>
    user = 'https://bugs.python.org/janssen'

    bugs.python.org fields:

    activity = <Date 2009-03-25.05:57:00.341>
    actor = 'intgr'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-02-14.16:39:22.436>
    closer = 'facundobatista'
    components = ['Library (Lib)']
    creation = <Date 2008-02-04.05:52:01.706>
    creator = 'janssen'
    dependencies = []
    files = ['9357', '9372', '9373']
    hgrepos = []
    issue_num = 2006
    keywords = []
    message_count = 12.0
    messages = ['62034', '62035', '62040', '62052', '62076', '62125', '62132', '62133', '62137', '62164', '62396', '62397']
    nosy_count = 6.0
    nosy_names = ['facundobatista', 'josiahcarlson', 'janssen', 'giampaolo.rodola', 'christian.heimes', 'intgr']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue2006'
    versions = ['Python 2.6']

    @janssen
    Copy link
    Mannequin Author

    janssen mannequin commented Feb 4, 2008

    I've been reading asyncore lately, and feel that it's showing its age.
    Most loops of this sort (we developed something similar for ILU, about
    15 years ago) contain handlers for timers and work tasks, in addition to
    input handling. For timers, typically there's a list of tasks and
    times, often with a repeat period. A system timer is set to the time of
    the next task to fire, and the select() loop is exited when it fires.
    The loop handler then looks down the list of timer tasks, and executes
    those ready to run. Similarly, most loops of this sort include a list
    of work tasks, and a policy for executing them, such as "take one task
    from the front of the list and run it, then do the select". This allows
    background tasks to get run that don't have associated input or output fds.

    @janssen janssen mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Feb 4, 2008
    @janssen
    Copy link
    Mannequin Author

    janssen mannequin commented Feb 4, 2008

    Looks like Giampaolo has already submitted a patch for part of this, in
    http://bugs.python.org/issue1641

    @tiran
    Copy link
    Member

    tiran commented Feb 4, 2008

    If you are going to spend some time with async event io you may be
    interested in my patch bpo-1657. It adds epoll and kqueue.

    @giampaolo
    Copy link
    Contributor

    I'm not sure to understand what do you mean by "work tasks".
    Do you need them to have ssl module work with asyncore?

    I've been reading asyncore lately, and feel that it's showing its age.

    Absolutely. I'd have some ideas about some asyncore/chat enhancements,
    including writing a poller suitable with epoll and kqueue, but it seems
    there are not enough people who cares enough about asyncore.

    @janssen
    Copy link
    Mannequin Author

    janssen mannequin commented Feb 5, 2008

    *I'm not sure to understand what do you mean by "work tasks".*

    They're low-priority tasks that need to get run sometime, but aren't
    associated with an input source. In ILU, we had a function called
    "do_soon", and you could call it with a function that should be called
    sometime in the near future.

    *writing a poller suitable with epoll and kqueue*

    Christian's patch looks interesting, in that respect. I haven't applied it
    to a codebase yet.

    Bill

    On Feb 4, 2008 2:00 PM, Giampaolo Rodola' <report@bugs.python.org> wrote:

    Giampaolo Rodola' added the comment:

    I'm not sure to understand what do you mean by "work tasks".
    Do you need them to have ssl module work with asyncore?

    > I've been reading asyncore lately, and feel that it's showing its age.

    Absolutely. I'd have some ideas about some asyncore/chat enhancements,
    including writing a poller suitable with epoll and kqueue, but it seems
    there are not enough people who cares enough about asyncore.


    Tracker <report@bugs.python.org>
    <http://bugs.python.org/issue2006\>


    @giampaolo
    Copy link
    Contributor

    I still don't get it.  Maybe you're talking about something like "call a
    function at the next select() loop" which in Twisted is equal to:
    >>> reactor.callLater(0, something)
    
    By using my patched asyncore you can do the same with:
    >>> self.call_later(0, something)

    @janssen
    Copy link
    Mannequin Author

    janssen mannequin commented Feb 7, 2008

    Yes, that's it exactly. So things without work tasks can still get done.

    But timers are the important thing. With timers you can always implement
    work tasks by yourself.

    On Feb 6, 2008 12:49 PM, Giampaolo Rodola' <report@bugs.python.org> wrote:

    Giampaolo Rodola' added the comment:

    I still don't get it. Maybe you're talking about something like "call a
    function at the next select() loop" which in Twisted is equal to:
    >>> reactor.callLater(0, something)

    By using my patched asyncore you can do the same with:
    >>> self.call_later(0, something)


    Tracker <report@bugs.python.org>
    <http://bugs.python.org/issue2006\>


    @janssen
    Copy link
    Mannequin Author

    janssen mannequin commented Feb 7, 2008

    Sorry, I meant to say, "so things without input FDs can make progress".

    On Feb 6, 2008 8:08 PM, Bill Janssen <bill.janssen@gmail.com> wrote:

    Yes, that's it exactly. So things without work tasks can still get done.

    But timers are the important thing. With timers you can always implement
    work tasks by yourself.

    On Feb 6, 2008 12:49 PM, Giampaolo Rodola' <report@bugs.python.org> wrote:

    >
    > Giampaolo Rodola' added the comment:
    >
    > I still don't get it. Maybe you're talking about something like "call a
    > function at the next select() loop" which in Twisted is equal to:
    > >>> reactor.callLater(0, something)
    >
    > By using my patched asyncore you can do the same with:
    > >>> self.call_later(0, something)
    >
    > __________________________________
    > Tracker <report@bugs.python.org>
    > <http://bugs.python.org/issue2006\>
    > __________________________________
    >

    @giampaolo
    Copy link
    Contributor

    Yes, that's it exactly. So things without input FDs can make progress".
    But timers are the important thing. With timers you can always
    implement work tasks by yourself.

    I have the feeling that you're talking about the same thing.

    >> self.call_later(0, something)

    Note that "something" is any callable object ('e.g. lambda: print
    "hello"'), not necessarily a fd.

    @janssen
    Copy link
    Mannequin Author

    janssen mannequin commented Feb 7, 2008

    Yes, I think we're talking about the same thing, too.

    @giampaolo
    Copy link
    Contributor

    Since this seems to be a duplicate of bpo-1641 I propose to close this issue.

    @facundobatista
    Copy link
    Member

    Because of Giampaolo suggestion, that is reviewing all these
    asyncore/asynchat issues.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants