test-fullautomation / robotframework

Generic automation framework for acceptance testing and RPA
http://robotframework.org
Apache License 2.0
1 stars 0 forks source link

threading: exception in thread causes backtrace #41

Closed test-fullautomation closed 2 months ago

test-fullautomation commented 7 months ago

exception in thread causes backtrace at very end of execution.

Expectation: exception is handeled andproperly logged when the error happens

Code:

*** Settings ***
Library    Collections

*** Keywords ***
threading_sync_base.thread1
    Log    entering thrd1    console=True
    Sleep    1
    Log    Causing exception by accessing not existing list    console=True
    Append To List    ${var_thrd}    11
    Log    This will not be reached    console=True
    Send Thread Notification    threading_sync_base.thread1_finished    0

*** Test Cases ***
Threading Sync Base

    THREAD    TEST_THREAD1    False
        threading_sync_base.thread1
    END

    Wait Thread Notification    threading_sync_base.thread1_finished    5

Log:

$  /usr/bin/env C:\\Users\\pol2hi\\AppData\\Local\\Temp\\rf-ls-run\\run_env_00_lyxs0a2r.bat -u c:\\Program\ Files\\RobotFramework\\robotvscode\\data\\extensions\\robocorp.robotframework-lsp-1.11.0\\src\\robotframework_debug_adapter\\run_robot__main__.py --port 64196 --no-debug -T -d C:\\RobotTest\\testcases\\..\\logfiles -b debug\\hanging_thread.log -l htmllog\\hanging_thread_log.html -o xmloutput\\hanging_thread_output.xml -r htmlreport\\hanging_thread_report.html c:\\RobotTest\\testcases\\hanging_thread.robot 
==============================================================================
Hanging Thread
==============================================================================
Threading Sync Base                                                   entering thrd1
Causing exception by accessing not existing list
RFStream Warning: keyword - BuiltIn.Wait Thread Notification did not have a corresponding pop.
Exception in thread TEST_THREAD1:
Traceback (most recent call last):
  File "C:\Program Files\RobotFramework\python39\lib\threading.py", line 980, in _bootstrap_inner
    self.run()
  File "C:\Program Files\RobotFramework\python39\lib\threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Program Files\RobotFramework\python39\lib\site-packages\robotframework-6.1-py3.9.egg\robot\running\bodyrunner.py", line 539, in run_worker
    runner.run(data.body)
  File "C:\Program Files\RobotFramework\python39\lib\site-packages\robotframework-6.1-py3.9.egg\robot\running\bodyrunner.py", line 62, in run        
    raise ExecutionFailures(errors)
robot.errors.ExecutionFailures: Variable '${var_thrd}' not found.
RFStream Warning: unable to pop keyword - BuiltIn.Wait Thread Notification because it does not match the current top: suite - s1
Threading Sync Base                                                   | FAIL |
Unable to received thread notification 'threading_sync_base.thread1_finished' in '5' seconds.
------------------------------------------------------------------------------
Hanging Thread                                                        | FAIL |
1 test, 0 passed, 1 failed, 0 unknown
==============================================================================
Debug:   C:\RobotTest\logfiles\debug\hanging_thread-20231108-113102.log
Output:  C:\RobotTest\logfiles\xmloutput\hanging_thread_output-20231108-113102.xml
Log:     C:\RobotTest\logfiles\htmllog\hanging_thread_log-20231108-113102.html
Report:  C:\RobotTest\logfiles\htmlreport\hanging_thread_report-20231108-113102.html
milanac030988 commented 2 months ago

*Fixed by https://github.com/test-fullautomation/robotframework/commit/4fe1d1c48d523285de6f7c375b3e2f55e69aaa38

test-fullautomation commented 2 months ago

integrated in RobotFramework AIO 0.11.0