[ 
https://issues.apache.org/jira/browse/IMPALA-14426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Riza Suminto resolved IMPALA-14426.
-----------------------------------
    Target Version: Impala 5.0.0
        Resolution: Fixed

> TestImpalaShell.test_cancellation failed with Python3.9
> -------------------------------------------------------
>
>                 Key: IMPALA-14426
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14426
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Clients
>    Affects Versions: Impala 5.0.0
>            Reporter: Riza Suminto
>            Assignee: Riza Suminto
>            Priority: Major
>             Fix For: Impala 5.0.0
>
>
> TestImpalaShell.test_cancellation failed in downstream build with Python3.9.
> {noformat}
> Stacktrace
> /data/jenkins/workspace/impala-cdw-master-core/repos/Impala/tests/shell/test_shell_commandline.py:563:
>  in test_cancellation
>     assert "Cancelling Query" in result.stderr, result.stderr
> E   AssertionError: 2025-09-10 10:54:04 [Exception] Unknown Exception 
> reentrant call inside <_io.BufferedWriter name='<stderr>'>
> E     Traceback (most recent call last):
> E       File 
> "/data/jenkins/workspace/impala-cdw-master-core/repos/Impala/shell/build/impala-shell-5.0.0-SNAPSHOT/install_py3.9/impala_shell/impala_shell.py",
>  line 739, in _signal_handler
> E         print(ImpalaShell.CANCELLATION_MESSAGE, file=sys.stderr)
> E     RuntimeError: reentrant call inside <_io.BufferedWriter name='<stderr>'>
> E     
> E     During handling of the above exception, another exception occurred:
> E     
> E     Traceback (most recent call last):
> E       File 
> "/data/jenkins/workspace/impala-cdw-master-core/repos/Impala/shell/build/impala-shell-5.0.0-SNAPSHOT/install_py3.9/impala_shell/impala_shell.py",
>  line 1482, in _execute_stmt
> E         self._print_if_verbose(
> E       File 
> "/data/jenkins/workspace/impala-cdw-master-core/repos/Impala/shell/build/impala-shell-5.0.0-SNAPSHOT/install_py3.9/impala_shell/impala_shell.py",
>  line 1218, in _print_if_verbose
> E         print(message, file=file_descriptor)
> E       File 
> "/data/jenkins/workspace/impala-cdw-master-core/repos/Impala/shell/build/impala-shell-5.0.0-SNAPSHOT/install_py3.9/impala_shell/impala_shell.py",
>  line 756, in _signal_handler
> E         print(err_details % (cancel_try + 1, 
> ImpalaShell.CANCELLATION_TRIES, err_msg),
> E     RuntimeError: reentrant call inside <_io.BufferedWriter name='<stderr>'>
> E     Could not execute command: select sleep(10) from 
> functional_parquet.alltypesagg
> E     
> E   assert 'Cancelling Query' in "2025-09-10 10:54:04 [Exception] Unknown 
> Exception reentrant call inside <_io.BufferedWriter 
> name='<stderr>'>\nTraceba..._io.BufferedWriter name='<stderr>'>\nCould not 
> execute command: select sleep(10) from functional_parquet.alltypesagg\n"
> E    +  where "2025-09-10 10:54:04 [Exception] Unknown Exception reentrant 
> call inside <_io.BufferedWriter 
> name='<stderr>'>\nTraceba..._io.BufferedWriter name='<stderr>'>\nCould not 
> execute command: select sleep(10) from functional_parquet.alltypesagg\n" = 
> <tests.shell.util.ImpalaShellResult object at 0x7fb1942fe5d0>.stderr{noformat}
> Changing the stderr printing from print() to os.write() seems to work because 
> os.write() directly calls the native API (a thin wrapper around the system 
> call), bypassing the Python IO stack (see the complete discussion 
> [here|https://stackoverflow.com/questions/75367828/runtimeerror-reentrant-call-inside-io-bufferedwriter-name-stdout]).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to