[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-07-15 Thread STINNER Victor

STINNER Victor added the comment:

I created a new repository just for this issue:
http://hg.python.org/sandbox/issue21645

I added a lot of debug. It looks like a race condition: the SIGCHLD signal is 
handled in a thread B (a C thread, not a Python), whereas the asyncio event 
loop is running in a thread A (the main thread, a Python thread).

Debug of the test which blocks:
---

PIPE: (7, 8)
threads [_MainThread(MainThread, started 34384933888)]
[pid 78351] _run_once: thread=34384933888
Execute Handle Task._step() created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/tasks.py:74
[pid 78351] _run_once: thread=34384933888
Execute Handle StreamReaderProtocol.connection_made(_UnixReadPipeTransport 
fd=7 polling) created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/unix_events.py:287
Execute Handle Future._set_result_unless_cancelled(None) created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/unix_events.py:290
[pid 78351] _run_once: thread=34384933888
Execute Handle Task._wakeup(Future finished result=None) created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/futures.py:239
Read pipe 7 connected: (_UnixReadPipeTransport fd=7 polling, 
asyncio.streams.StreamReaderProtocol object at 0x806e257a8)
[pid 78351] _run_once: thread=34384933888
Execute Handle _raise_stop_error(Task finished 
coro=BaseEventLoop.connect_read_pipe() done, defined at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:767
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:258
 result=(_UnixReadPipeTransport fd=7 polling, 
asyncio.streams.StreamReaderProtocol object at 0x806e257a8)) at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:95
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/futures.py:239
Execute Handle _raise_stop_error(Task finished 
coro=BaseEventLoop.connect_read_pipe() done, defined at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:767
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:258
 result=(_UnixReadPipeTransport fd=7 polling, 
asyncio.streams.StreamReaderProtocol object at 0x806e257a8)) at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:95
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/futures.py:239:
 FAIL! _StopError()
add_signal_handler(Signals.SIGCHLD, bound method SafeChildWatcher._sig_chld of 
asyncio.unix_events.SafeChildWatcher object at 0x806e25810, ())
PY signal.signal(Signals.SIGCHLD)
[pid 78351] _run_once: thread=34384933888
Execute Handle Task._step() created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/tasks.py:74
execute program '/usr/home/buildbot/buildarea/custom.krah-freebsd/build/python'
process '/usr/home/buildbot/buildarea/custom.krah-freebsd/build/python' 
created: pid 78390
execute program 
'/usr/home/buildbot/buildarea/custom.krah-freebsd/build/python': 
_UnixSubprocessTransport pid=78390
[pid 78351] _run_once: thread=34384933888
Execute Handle 
SubprocessStreamProtocol.connection_made(_UnixSubprocessTransport pid=78390) 
created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_subprocess.py:121
[pid 78351] _run_once: thread=34384933888
Execute Handle Task._wakeup(Future finished result=None) created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/futures.py:239
[pid 78351] _run_once: thread=34384933888
Execute Handle _raise_stop_error(Task finished coro=create_subprocess_exec() 
done, defined at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/subprocess.py:208
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:258
 result=Process 78390) at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:95
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/futures.py:239
Execute Handle _raise_stop_error(Task finished coro=create_subprocess_exec() 
done, defined at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/subprocess.py:208
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:258
 result=Process 78390) at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/base_events.py:95
 created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/futures.py:239:
 FAIL! _StopError()
[pid 78351] _run_once: thread=34384933888
Execute Handle Task._step() created at 
/usr/home/buildbot/buildarea/custom.krah-freebsd/build/Lib/asyncio/tasks.py:74
[pid 78351] _run_once: thread=34384933888
select(None)
(1) import
(2) dump traceback
select(None) - [(SelectorKey(fileobj=7, fd=7, events=1, data=(Handle 
_UnixReadPipeTransport._read_ready() created 

[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-07-15 Thread STINNER Victor

STINNER Victor added the comment:

I'm running tests on the buildbot AMD64 FreeBSD 9.0 custom:
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20custom/builds/27/steps/test/logs/stdio

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-07-15 Thread STINNER Victor

STINNER Victor added the comment:

(1) the thread B gets the SIGCHLD signal: it writes a byte into the self pipe 
of the event loop

   C signal_handler: sig_num=20, thread=34468857856
   trip_signal(20): write()

(2) in the main thread, the event loop is awaken by the write in the pipe... 
but there is nothing to do

   _read_from_self - b'\x14', thread=34384933888

(3) the thread B schedules the callback

   Py_AddPendingCall(checksignals_witharg), thread=34468857856

(I modified the output a little bit for readability.)

IMO the problem is that asyncio relies on two events:

* signal number written in the self pipe of the event loop
* callback scheduled by the C handler

A solution would be to schedule the callback in the event loop. Since Python 
3.3, the C signal handler writes the signal number, which should be enough to 
find and schedule the Python callback.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-07-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a0e6a370755f by Victor Stinner in branch 'default':
Issue #21645: Add debug code to analyze a failure on FreeBSD 9
http://hg.python.org/cpython/rev/a0e6a370755f

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-07-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dbf991650441 by Victor Stinner in branch 'default':
Issue #21645: test_asyncio, log debug trace into sys.__stderr__, not in
http://hg.python.org/cpython/rev/dbf991650441

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-07-14 Thread STINNER Victor

STINNER Victor added the comment:

Buildbot where the issue occurs:
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.x/

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-06-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 69d474dab479 by Victor Stinner in branch 'default':
Issue #21645: asyncio: add a watchdog in test_read_all_from_pipe_reader() for
http://hg.python.org/cpython/rev/69d474dab479

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-06-06 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
components: +Asyncio

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-06-02 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%203.4/builds/191/steps/test/logs/stdio

[  8/389] test_asyncio
Timeout (1:00:00)!
Thread 0x000801407400 (most recent call first):
  File /usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/selectors.py, 
line 494 in select
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/asyncio/base_events.py,
 line 795 in _run_once
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/asyncio/base_events.py,
 line 184 in run_forever
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/asyncio/base_events.py,
 line 203 in run_until_complete
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/test_asyncio/test_streams.py,
 line 617 in test_read_all_from_pipe_reader
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/case.py, 
line 577 in run
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/case.py, 
line 625 in __call__
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/suite.py, 
line 125 in run
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/suite.py, 
line 87 in __call__
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/suite.py, 
line 125 in run
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/suite.py, 
line 87 in __call__
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/suite.py, 
line 125 in run
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/suite.py, 
line 87 in __call__
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/unittest/runner.py, 
line 168 in run
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/support/__init__.py,
 line 1724 in _run_suite
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/support/__init__.py,
 line 1758 in run_unittest
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/test_asyncio/__init__.py,
 line 29 in test_main
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/regrtest.py, 
line 1278 in runtest_inner
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/regrtest.py, 
line 967 in runtest
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/regrtest.py, 
line 763 in main
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/regrtest.py, 
line 1562 in main_in_temp_cwd
  File 
/usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/test/__main__.py, 
line 3 in module
  File /usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/runpy.py, line 
85 in _run_code
  File /usr/home/buildbot/buildarea/3.4.krah-freebsd/build/Lib/runpy.py, line 
170 in _run_module_as_main

--
components: Tests
keywords: buildbot
messages: 219647
nosy: giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

2014-06-02 Thread Guido van Rossum

Guido van Rossum added the comment:

Maybe see Tulip issue 168? That test was added to support that. Maybe the fix 
doesn't work for this platform?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21645
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com