Skip to content

test_asynchat fails on Mac OSX #50048

Closed
Closed

Description

@donmez
mannequin
BPO 5798
Nosy @warsaw, @facundobatista, @josiahcarlson, @mdickinson, @giampaolo, @benjaminp, @ned-deily, @bitdancer
Files
  • issue5798_release26.patch
  • 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 = 'https://github.com/warsaw'
    closed_at = <Date 2010-08-04.14:42:53.443>
    created_at = <Date 2009-04-20.11:02:11.341>
    labels = ['type-bug', 'tests', 'release-blocker']
    title = 'test_asynchat fails on Mac OSX'
    updated_at = <Date 2010-08-04.14:43:18.192>
    user = 'https://bugs.python.org/donmez'

    bugs.python.org fields:

    activity = <Date 2010-08-04.14:43:18.192>
    actor = 'mark.dickinson'
    assignee = 'barry'
    closed = True
    closed_date = <Date 2010-08-04.14:42:53.443>
    closer = 'mark.dickinson'
    components = ['Tests']
    creation = <Date 2009-04-20.11:02:11.341>
    creator = 'donmez'
    dependencies = []
    files = ['18384']
    hgrepos = []
    issue_num = 5798
    keywords = ['patch']
    message_count = 40.0
    messages = ['86193', '86529', '87368', '87371', '87375', '87377', '87379', '87386', '87392', '87393', '87400', '87402', '87403', '87404', '87405', '87406', '87408', '87416', '87417', '87419', '87444', '87447', '87453', '87455', '87458', '87465', '87467', '87470', '87477', '88798', '88813', '88822', '88855', '88888', '88889', '88890', '88920', '112809', '112811', '112813']
    nosy_count = 11.0
    nosy_names = ['barry', 'facundobatista', 'josiahcarlson', 'mark.dickinson', 'alanmcintyre', 'giampaolo.rodola', 'donmez', 'MrJean1', 'benjamin.peterson', 'ned.deily', 'r.david.murray']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue5798'
    versions = ['Python 2.6']

    Activity

    1. donmez commented on Apr 20, 2009

      donmezmannequin
      MannequinAuthor

      Using latest python 2.6 branch; test_asynchat fails with the following
      error:

      error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x1689238> (<class
      'socket.error'>:[Errno 9] Bad file descriptor
      [/Users/cartman/Sources/python-2.6/Lib/asyncore.py|readwrite|107]
      [/Users/cartman/Sources/python-2.6/Lib/asyncore.py|handle_expt_event|441] [<string>|getsockopt|1]
      [/Users/cartman/Sources/python-2.6/Lib/socket.py|_dummy|165])

      Using Mac OSX 10.5.6.

    2. mdickinson commented on Apr 25, 2009

      @mdickinson
      Member

      I'm seeing this failure on 2.7, 3.0 and 3.1 as well.

    3. donmez commented on May 7, 2009

      donmezmannequin
      MannequinAuthor

      Still fails in 3.1 beta1.

    4. mdickinson commented on May 7, 2009

      @mdickinson
      Member

      I tried to track this down, but ran out of time. Here's
      the little that I discovered; maybe someone else with
      access to OS X (which I have) and an understanding of
      poll (which I lack) can build on this.

      The failure has to do with select.poll differences between Linux
      and OS X. It seems that OS X can return POLLIN | POLLPRI | POLLHUP
      in situations where Linux just returns POLLIN, and this combination
      of flags causes the code in asyncore to first close the socket and
      then try to read from it. The relevant code is at around line 440
      of Lib/asyncore.py.

    5. mdickinson commented on May 7, 2009

      @mdickinson
      Member

      r56632 looks relevant:

      """When running asynchat tests on OS X (darwin), the test client now
      overrides asyncore.dispatcher.handle_expt to do nothing, since
      select.poll gives a POLLHUP error at the completion of these tests.
      Added timeout & count arguments to several asyncore.loop calls to
      avoid the possibility of a test hanging up a build. [GSoC - Alan
      McIntyre]"""

      Adding Facundo Batista and Alan McIntyre to the nosy list. Does either of
      you know what's going on with this issue?

    6. MrJean1 commented on May 7, 2009

      MrJean1mannequin
      Mannequin

      Here is a (new?) failure of test_asynchat with Python 3.1b1 on MacOS X
      10.4.11 (Intel).

      % make test
      ....
      test test_asynchat produced unexpected output:


      *** lines 2-16 of actual output doesn't appear in expected output after
      line 1:
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcc30> (<class 'socket.error'

      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcb90> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcf90> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcd50> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcc30> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcb90> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcf90> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcd50> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcc30> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcb90> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dc2d0> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcc30> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcbb0> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcb90> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel
      <test.test_asynchat.echo_client at 0x21dcd50> (<class 'socket.error'
      :[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-3
      .1b1/Lib/asyncore.py|handle_expt_event|440])


      ....

      % ./python.exe Lib/test/test_asynchat.py
      test_close_when_done (main.TestAsynchat) ... ok
      test_empty_line (main.TestAsynchat) ... ok
      test_line_terminator1 (main.TestAsynchat) ... ok
      test_line_terminator2 (main.TestAsynchat) ... ok
      test_line_terminator3 (main.TestAsynchat) ... ok
      test_none_terminator (main.TestAsynchat) ... ok
      test_numeric_terminator1 (main.TestAsynchat) ... ok
      test_numeric_terminator2 (main.TestAsynchat) ... ok
      test_simple_producer (main.TestAsynchat) ... ok
      test_string_producer (main.TestAsynchat) ... ok
      test_close_when_done (main.TestAsynchat_WithPoll) ... ok
      test_empty_line (main.TestAsynchat_WithPoll) ... error: uncaptured
      python exception, closing channel <main.echo_client at 0x107cf30>
      (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator1 (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107c3f0> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel
      <main.echo_client at 0x107ceb0> (<class 'socket.error'>:[Errno 9]
      Bad file descriptor [../Python-3.1b1/Lib/asyncore.py|readwrite|106]
      [../Python-3.1b1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel
      <main.echo_client at 0x107cf50> (<class 'socket.error'>:[Errno 9]
      Bad file descriptor [../Python-3.1b1/Lib/asyncore.py|readwrite|106]
      [../Python-3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator2 (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107ce70> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel
      <main.echo_client at 0x107ced0> (<class 'socket.error'>:[Errno 9]
      Bad file descriptor [../Python-3.1b1/Lib/asyncore.py|readwrite|106]
      [../Python-3.1b1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel
      <main.echo_client at 0x107cf30> (<class 'socket.error'>:[Errno 9]
      Bad file descriptor [../Python-3.1b1/Lib/asyncore.py|readwrite|106]
      [../Python-3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator3 (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107ceb0> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel
      <main.echo_client at 0x107cf50> (<class 'socket.error'>:[Errno 9]
      Bad file descriptor [../Python-3.1b1/Lib/asyncore.py|readwrite|106]
      [../Python-3.1b1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel
      <main.echo_client at 0x107cef0> (<class 'socket.error'>:[Errno 9]
      Bad file descriptor [../Python-3.1b1/Lib/asyncore.py|readwrite|106]
      [../Python-3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_none_terminator (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107cf50> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_numeric_terminator1 (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107ce10> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_numeric_terminator2 (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107ce50> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_simple_producer (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107cdb0> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_string_producer (main.TestAsynchat_WithPoll) ... error:
      uncaptured python exception, closing channel <main.echo_client at
      0x107cf50> (<class 'socket.error'>:[Errno 9] Bad file descriptor
      [../Python-3.1b1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1b1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_find_prefix_at_end (main.TestHelperFunctions) ... ok
      test_basic (main.TestFifo) ... ok
      test_given_list (main.TestFifo) ... ok

      ----------------------------------------------------------------------
      Ran 23 tests in 7.712s

      OK

    7. bitdancer commented on May 7, 2009

      @bitdancer
      Member

      See also bpo-1161031, especially Giampaolo's suggestion near the end.
      Seems like it might be relevant. I was the one who merged Josiah's
      trunk fix into othe other branches, to get things back into sync, but I
      don't claim to understand the code at any deep level. From the review I
      did at my level of knowledge it seems like the change to the behavior of
      when handle_expt_event is called is correct, but I was a little worried
      about backward compatibility. I now wonder if that fix should be backed
      out of 2.6 and 3.0, and advertised in What's New for 2.7 and 3.1.

    8. josiahcarlson commented on May 7, 2009

      josiahcarlsonmannequin
      Mannequin

      Looking at trunk, it seems like one reasonable option is to swap the
      order of handle_close() and handle_expt_event() testing and calls. That
      would keep all reading/writing before handle_close(), which should be
      correct.

    9. mdickinson commented on May 7, 2009

      @mdickinson
      Member

      Josiah, that solution isn't working for me; it looks as though there's
      a deeper weirdness: what I'm seeing is that on OS X, in e.g.
      test_emptyline, we end up calling the readwrite function in asyncore.py
      with flags = POLLIN | POLLPRI | POLLHUP. The first thing that gets
      called is obj.handle.read_event, and bizarrely it seems to be the
      read_event call that has the effect of closing the socket. So the
      socket's already closed by the time we get to obj.handle_expt_event and
      the same error as before occurs.

      I'm still trying to figure out why.

    10. mdickinson commented on May 7, 2009

      @mdickinson
      Member

      So the sequence of events seems to be:
      asyncore.readwrite calls obj.handle_read_event
      ... which calls obj.handle_read (3rd branch of handle_read_event)
      ... which is defined in asynchat.py; it calls obj.recv
      ... (back in asyncore now): recv calls obj.socket.recv
      ... and gets no data, so it then calls obj.handle_close
      ... which calls obj.close(), and so closes obj.socket as well.

      and now obj.handle_expt_event gets confused because the socket is
      closed.

      Now what?

    11. josiahcarlson commented on May 7, 2009

      josiahcarlsonmannequin
      Mannequin

      It would seem that we need to be more defensive in our calls. We need
      to check to make sure that the socket isn't closed before calling
      read/write/expt events.

    12. josiahcarlson commented on May 7, 2009

      josiahcarlsonmannequin
      Mannequin

      Mark, try this:

              if flags & select.POLLIN and (obj.connected or obj.accepting):
                  obj.handle_read_event()
              if flags & select.POLLOUT and obj.connected:
                  obj.handle_write_event()
              if flags & select.POLLPRI and obj.connected:
                  obj.handle_expt_event()
              if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
                  obj.handle_close()
    13. mdickinson commented on May 7, 2009

      @mdickinson
      Member

      That fixes test_empty_line (in test_asynchat.py), but now I get a hang in
      test_close_when_done.

      By the way, here's an interesting site that goes some way to explaining
      what to expect from select.poll and EOF.

      http://www.greenend.org.uk/rjk/2001/06/poll.html

    14. 18 remaining items

    15. josiahcarlson commented on Jun 3, 2009

      josiahcarlsonmannequin
      Mannequin

      Fixed in trunk in 73182, fixed in py3k in 73183.

      Closing as fixed.

    16. ned-deily commented on Jun 4, 2009

      @ned-deily
      Member

      Verified test_asynchat no longer fails in trunk nor py3k. Thanks!

    17. MrJean1 commented on Jun 4, 2009

      MrJean1mannequin
      Mannequin

      Well, with fresh build of Python 3.1rc1 on MacOS X 10.4.11 Tiger (Intel) test_asynchat.py rev 73183 still seems to
      fail, perhaps differently. Here is 3 different results. First, rev 73183:

      % ./python.exe Lib/test/test_asynchat73183.py
      test_close_when_done (main.TestAsynchat) ... ok
      test_empty_line (main.TestAsynchat) ... ok
      test_line_terminator1 (main.TestAsynchat) ... ok
      test_line_terminator2 (main.TestAsynchat) ... ok
      test_line_terminator3 (main.TestAsynchat) ... ok
      test_none_terminator (main.TestAsynchat) ... ok
      test_numeric_terminator1 (main.TestAsynchat) ... ok
      test_numeric_terminator2 (main.TestAsynchat) ... ok
      test_simple_producer (main.TestAsynchat) ... ok
      test_string_producer (main.TestAsynchat) ... ok
      test_close_when_done (main.TestAsynchat_WithPoll) ... ok
      test_empty_line (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x10835b0> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator1 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083550> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x1083610> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x10835f0> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator2 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083630> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x1083870> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x10838b0> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator3 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083610> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x1083550> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x10835f0> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_none_terminator (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083550> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_numeric_terminator1 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083630> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_numeric_terminator2 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x10837f0> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_simple_producer (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083910> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_string_producer (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x10835b0> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_find_prefix_at_end (main.TestHelperFunctions) ... ok
      test_basic (main.TestFifo) ... ok
      test_given_list (main.TestFifo) ... ok

      ----------------------------------------------------------------------
      Ran 23 tests in 7.717s

      OK

      Second, this is the result of test_asyncat.py included in Python 3.1rc1:

      % ./python.exe Lib/test/test_asynchat.py
      test_close_when_done (main.TestAsynchat) ... ok
      test_empty_line (main.TestAsynchat) ... ok
      test_line_terminator1 (main.TestAsynchat) ... ok
      test_line_terminator2 (main.TestAsynchat) ... ok
      test_line_terminator3 (main.TestAsynchat) ... ok
      test_none_terminator (main.TestAsynchat) ... ok
      test_numeric_terminator1 (main.TestAsynchat) ... ok
      test_numeric_terminator2 (main.TestAsynchat) ... ok
      test_simple_producer (main.TestAsynchat) ... ok
      test_string_producer (main.TestAsynchat) ... ok
      test_close_when_done (main.TestAsynchat_WithPoll) ... ok
      test_empty_line (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x10835b0> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator1 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083550> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x1083610> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x10835f0> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator2 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083630> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x1083870> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x10838b0> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_line_terminator3 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083610> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x1083550> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      error: uncaptured python exception, closing channel <main.echo_client at 0x10835f0> (<class
      'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_none_terminator (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083550> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_numeric_terminator1 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083670> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_numeric_terminator2 (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x10837f0> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_simple_producer (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x1083910> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_string_producer (main.TestAsynchat_WithPoll) ... error: uncaptured python exception, closing channel
      <main.echo_client at 0x10835b0> (<class 'socket.error'>:[Errno 9] Bad file descriptor [../Python-
      3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      ok
      test_find_prefix_at_end (main.TestHelperFunctions) ... ok
      test_basic (main.TestFifo) ... ok
      test_given_list (main.TestFifo) ... ok

      ----------------------------------------------------------------------
      Ran 23 tests in 7.721s

      OK

      Both are not the exact same, but equivalent. Lastly, here are 4 snippets from the 'make test' output.

      ....<deleted>....

      test test_asynchat produced unexpected output:


      *** lines 2-16 of actual output doesn't appear in expected output after line 1:
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22704f0> (<class
      'socket.error'

      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270b10> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22704b0> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270470> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22703d0> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270450> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22704f0> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22704b0> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270b10> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270530> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270b10> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270470> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22704d0> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x22709f0> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])
      + error: uncaptured python exception, closing channel <test.test_asynchat.echo_client at 0x2270b10> (<class
      'socket.error'
      :[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [../Tools/Python-
      3.1rc1/Lib/asyncore.py|handle_expt_event|440])


      ....<deleted>....

      test_cmd_line
      test test_cmd_line failed -- Traceback (most recent call last):
        File "../Tools/Python-3.1rc1/Lib/test/test_cmd_line.py", line 145, in test_run_code
          0)
      AssertionError: 1 != 0
      ....<deleted>....

      test test_smtplib produced unexpected output:


      *** line 2 of actual output doesn't appear in expected output after line 1:
      + error: uncaptured python exception, closing channel <test.test_smtplib.SimSMTPChannel 127.0.0.1:50714 at
      0x3b21ff0> (<cl
      ass 'socket.error'>:[Errno 9] Bad file descriptor [../Python-3.1rc1/Lib/asyncore.py|readwrite|106] [/Users/
      ../Python-3.1rc1/Lib/asyncore.py|handle_expt_event|440])


      ....<deleted>....

      308 tests OK.
      3 tests failed:
      test_asynchat test_cmd_line test_smtplib
      25 tests skipped:
      test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp
      test_codecmaps_kr test_codecmaps_tw test_curses test_dbm_gnu
      test_epoll test_largefile test_nis test_normalization
      test_ossaudiodev test_pep277 test_smtpnet test_socketserver
      test_startfile test_timeout test_tk test_ttk_guionly
      test_urllib2net test_urllibnet test_winreg test_winsound
      test_xmlrpc_net test_zipfile64
      Those skips are all expected on darwin.
      make: *** [test] Error 1

    18. bitdancer commented on Jun 4, 2009

      @bitdancer
      Member

      I presume you mean "a fresh build of 3.1rc1+" (from svn)? 3.1rc1 does
      not contain the most recent fix.

    19. josiahcarlson commented on Jun 4, 2009

      josiahcarlsonmannequin
      Mannequin

      I installed 3.1rc1 on my OS X (10.5.?) machine, updated asynchat, and ran
      the test with and without my change. Without my change, it breaks in the
      way described numerous times. With my change, it seems to work fine on OS
      X, linux, and Windows for me.

      Looking at line 106 in py3k/Lib/asyncore.py
      (http://svn.python.org/view/python/branches/py3k/Lib/asyncore.py?
      annotate=73183) gets me "obj.handle_close()". Your tracebacks show line
      106 calling "obj.handle_expt_event()", which is the old code.

    20. MrJean1 commented on Jun 5, 2009

      MrJean1mannequin
      Mannequin

      Correct. With new Lib/asyncore.py file rev 73183 all 23 tests in the
      original test_asynchat.py pass in Python 3.1rc1 built from source on
      MacOS X 10.4.11 Tiger (Intel).

      % ./python.exe Lib/test/test_asynchat.py
      test_close_when_done (main.TestAsynchat) ... ok
      test_empty_line (main.TestAsynchat) ... ok
      test_line_terminator1 (main.TestAsynchat) ... ok
      test_line_terminator2 (main.TestAsynchat) ... ok
      test_line_terminator3 (main.TestAsynchat) ... ok
      test_none_terminator (main.TestAsynchat) ... ok
      test_numeric_terminator1 (main.TestAsynchat) ... ok
      test_numeric_terminator2 (main.TestAsynchat) ... ok
      test_simple_producer (main.TestAsynchat) ... ok
      test_string_producer (main.TestAsynchat) ... ok
      test_close_when_done (main.TestAsynchat_WithPoll) ... ok
      test_empty_line (main.TestAsynchat_WithPoll) ... ok
      test_line_terminator1 (main.TestAsynchat_WithPoll) ... ok
      test_line_terminator2 (main.TestAsynchat_WithPoll) ... ok
      test_line_terminator3 (main.TestAsynchat_WithPoll) ... ok
      test_none_terminator (main.TestAsynchat_WithPoll) ... ok
      test_numeric_terminator1 (main.TestAsynchat_WithPoll) ... ok
      test_numeric_terminator2 (main.TestAsynchat_WithPoll) ... ok
      test_simple_producer (main.TestAsynchat_WithPoll) ... ok
      test_string_producer (main.TestAsynchat_WithPoll) ... ok
      test_find_prefix_at_end (main.TestHelperFunctions) ... ok
      test_basic (main.TestFifo) ... ok
      test_given_list (main.TestFifo) ... ok

      ----------------------------------------------------------------------
      Ran 23 tests in 7.726s

      OK

    21. mdickinson commented on Aug 4, 2010

      @mdickinson
      Member

      Josiah's fix in r73182 applies cleanly to the release26-maint branch, and fixes (for me, at least) the current OS X failures in test_asynchat and test_smtplib. I've attached a patch with the backport of this fix, and a Misc/NEWS entry.

      Barry, can this go in before 2.6.6 final?

    22. warsaw commented on Aug 4, 2010

      @warsaw
      Member

      Thanks Mark, go ahead and apply this, then close this issue.

    23. mdickinson commented on Aug 4, 2010

      @mdickinson
      Member

      Applied in r83718.

    24. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    release-blockertestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions