Skip to content

Timeouts are deactivated if library keyword uses BuiltIn.run_keyword (except on Windows) #5422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pekkaklarck opened this issue May 6, 2025 · 0 comments

Comments

@pekkaklarck
Copy link
Member

If a library keyword calls another keyword by using BuiltIn.run_keyword, timeouts are deactivated and the calling keyword is not stopped if it takes too much time or even hangs. For example, this keyword hangs and timeouts cannot stop it:

def example():
    BuiltIn().run_keyword("Log", "Hello!")
    while True:
        time.sleep(0)

This problem doesn't occur on Windows, because there the low level timeout implementation is different than on other platforms. The underlying reason is that outside Windows timeouts are implemented using signals that are enabled when a library keyword starts and disabled when it ends. When a library keyword calls another keyword via BuiltIn.run_keyword, timeouts are disabled when the called keyword ends. This is easy to fix by keeping count on how many times signals have been activated and deactivating them only when that count gets to zero.

I noticed this when investigating how to prevent output files being corrupted if a library keywords uses Builtin.run_keyword and timeouts are used (#5417). This issue explains why that problem manifested itself only on Windows and with this issue fixed that problem occurs also elsewhere. That can be considered a bad and backwards incompatible thing, but I still believe it's better to fix this issue. If we want to fix #5417 by disabling timeouts if BuiltIn.run_keyword is used, we should do it explicitly and consistently on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant