IMPALA-6740: Fix flaky test_cancellation

test_shall_commandline:test_cancellation starts an Impala shell
process, runs a query, sleeps briefly, and then cancels the query by
sending a SIGINT to the process. This has been occasionally failing
with either the error 'KeyboardInterrupt' or with the query succeeding
instead of being cancelled.

The problem occurs if the process hasn't fully started up before the
SIGINT is sent - in particular, if ImpalaShell:__init__ hasn't
installed the signal handler, which happens sometimes depending on
concurrent load on the machine. Depending on the exact timing, this
may cause a 'KeyboardInterrupt' that isn't handled, or the signal
may be ignored and the query allowed to run to completion.

The solution is to increase the time spent sleeping.

Testing:
- I can reliably repro the problem locally by reducing the sleep time.

Change-Id: I5d13de6207807e4ba2e2e406a29d670f01d6c3a0
Reviewed-on: http://gerrit.cloudera.org:8080/10177
Reviewed-by: Thomas Tauber-Marshall <tmarshall@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Thomas Tauber-Marshall
2018-04-24 12:23:23 -07:00
committed by Impala Public Jenkins
parent e9535bc024
commit 20c161d758

View File

@@ -318,9 +318,9 @@ class TestImpalaShell(ImpalaTestSuite):
def test_cancellation(self):
"""Test cancellation (Ctrl+C event)."""
args = '-q "select sleep(10000)"'
args = '-q "select sleep(100000)"'
p = ImpalaShell(args)
sleep(3)
sleep(6)
os.kill(p.pid(), signal.SIGINT)
result = p.get_result()