Re: Issue 571737 in chromium: [chameleon perbuild] Unhandled BadStatusLine for hdmi and audio tests

2 views
Skip to first unread message

chro...@googlecode.com

unread,
Dec 29, 2015, 9:12:34 PM12/29/15
to chromi...@chromium.org
Updates:
Summary: [chameleon perbuild] Unhandled BadStatusLine for hdmi and audio
tests
Owner: waih...@chromium.org

Comment #4 on issue 571737 by ka...@chromium.org: [chameleon perbuild]
Unhandled BadStatusLine for hdmi and audio tests
https://code.google.com/p/chromium/issues/detail?id=571737

Mostly hdmi tests affected now.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

chro...@googlecode.com

unread,
Dec 30, 2015, 4:55:41 AM12/30/15
to chromi...@chromium.org
Updates:
Status: Started
Owner: cychi...@chromium.org

Comment #5 on issue 571737 by cychi...@chromium.org: [chameleon perbuild]
Unhandled BadStatusLine for hdmi and audio tests
https://code.google.com/p/chromium/issues/detail?id=571737

The problem is that xmlrpc server can not get stopped gracefully.


def run(self):
"""Block and handle many XmlRpc requests."""
logging.info('XmlRpcServer starting...')
# TODO(wiley) nested is deprecated, but we can't use the replacement
# until we move to Python 3.0.
with contextlib.nested(*self._delegates):
while self._keep_running:
try:
self._server.handle_request()
except select.error as v:
# In a cruel twist of fate, the python library doesn't
# handle this kind of error.
if v[0] != errno.EINTR:
raise
logging.info('XmlRpcServer exited.')


The signal handler of SIGINT change self._keep_running to False, however,
server is not stopped.
This cause the subsequence server can not reuse the port, and cause the
BadStatusLine error message on client side.


I suspect this is due to python version change from 2.7.3 to 2.7.10.

However, contextlib.py in 2.7.3 and 2.7.10 are the same, so need further
investigation.

chro...@googlecode.com

unread,
Dec 30, 2015, 4:57:12 AM12/30/15
to chromi...@chromium.org

Comment #6 on issue 571737 by cychi...@chromium.org: [chameleon perbuild]
Unhandled BadStatusLine for hdmi and audio tests
https://code.google.com/p/chromium/issues/detail?id=571737

Btw, this should cause problem to all the tests that use xmlrpc server, at
least, including bluetooth_device_xmlrpc_server and
multimedia_xmlrpc_server.

chro...@googlecode.com

unread,
Dec 30, 2015, 6:44:15 AM12/30/15
to chromi...@chromium.org

Comment #7 on issue 571737 by cychi...@chromium.org: [chameleon perbuild]
Unhandled BadStatusLine for hdmi and audio tests
https://code.google.com/p/chromium/issues/detail?id=571737

contextlib is not the cause.
The root cause is in python2.7/SocketServer.py

In 2.7.10, handle_request of BaseServer wraps select.select with a retry
when error is EINTR.
So, when SIGINT raise the exception in select, it retries, and then it
blocks forever (because timeout is None) until the next call from client.

Using a different timeout value can solve the wait, but it delays the time
server should shutdown by that timeout amount.
I think we should let server receives a different signal so it does not get
retried.
Not sure how to achieve that.


def handle_request(self):
"""Handle one request, possibly blocking.

Respects self.timeout.
"""
# Support people who used socket.settimeout() to escape
# handle_request before self.timeout was available.
timeout = self.socket.gettimeout()
if timeout is None:
timeout = self.timeout
elif self.timeout is not None:
timeout = min(timeout, self.timeout)
fd_sets = _eintr_retry(select.select, [self], [], [], timeout)
if not fd_sets[0]:
self.handle_timeout()
return
self._handle_request_noblock()


def _eintr_retry(func, *args):
"""restart a system call interrupted by EINTR"""
while True:
try:
return func(*args)
except (OSError, select.error) as e:
if e.args[0] != errno.EINTR:
raise

chro...@googlecode.com

unread,
Dec 30, 2015, 7:37:13 AM12/30/15
to chromi...@chromium.org

Comment #8 on issue 571737 by cychi...@chromium.org: [chameleon perbuild]
Unhandled BadStatusLine for hdmi and audio tests
https://code.google.com/p/chromium/issues/detail?id=571737

I think this is tricky. The server thread does not receive the SIGINT or
SIGTERM because main thread is the only thread receiving the signal.
Server thread just somehow gets the EINTR error in select.

chro...@googlecode.com

unread,
Dec 30, 2015, 9:52:36 AM12/30/15
to chromi...@chromium.org

Comment #9 on issue 571737 by cychi...@chromium.org: [chameleon perbuild]
Unhandled BadStatusLine for hdmi and audio tests
https://code.google.com/p/chromium/issues/detail?id=571737

The discussion here https://bugs.python.org/issue7978 explains the history
of the change http://bugs.python.org/review/7978/show.

As we reinvented the wheel in run of XmlRpcServer, we should use a timeout
on select like what serve_forever in BaseServer does.

So I will go for the fix to use timeout=0.5 in select.
Reply all
Reply to author
Forward
0 new messages