You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2020/03/28 21:34:37 UTC

[impala] 04/06: IMPALA-9547: retry accept in test_shell_commandline

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch branch-3.4.0
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 088b2c2bb26fe83cdabdcb2ecf372d2fa5500eb3
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Mon Mar 23 20:36:09 2020 -0700

    IMPALA-9547: retry accept in test_shell_commandline
    
    This is a point solution to this particular socket.accept()
    call failing. The more general problem is described in
    https://www.python.org/dev/peps/pep-0475/ and fixed in
    Python 3.5.
    
    Change-Id: Icc9cab98b059042855ca9149427d079951471be0
    Reviewed-on: http://gerrit.cloudera.org:8080/15541
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
    (cherry picked from commit 35d2718d36c06abe867dff61307be920325e8a5e)
---
 tests/shell/test_shell_commandline.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/shell/test_shell_commandline.py b/tests/shell/test_shell_commandline.py
index ac8e07b..ec16641 100644
--- a/tests/shell/test_shell_commandline.py
+++ b/tests/shell/test_shell_commandline.py
@@ -17,6 +17,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import errno
 import os
 import pytest
 import re
@@ -789,7 +790,15 @@ class TestImpalaShell(ImpalaTestSuite):
       try:
         connection = None
         impala_shell = Popen(shell_cmd + args, stdout=devnull, stderr=devnull)
-        connection, client_address = sock.accept()
+        # IMPALA-9547: retry accept(). This is required in Python < 3.5 because some
+        # EINTR return calls from syscalls are not automatically retried. See PEP475.
+        while True:
+          try:
+            connection, client_address = sock.accept()
+            break
+          except IOError, e:
+            if e.errno != errno.EINTR:
+              raise
         data = connection.recv(1024)
         assert expected_output in data
       finally: