Skip to content
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

[Bug] Debugger doesnt return to command line when using RobotCode in combination with ScreenCapLibrary #131

Closed
Daniwin82 opened this issue Mar 13, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Daniwin82
Copy link

SUMMARY:
When using the robotcode extension, RF doesn't return to the commandline after finishing a testcase.
RF: 4.1.3 and 6.0.2
extension version: 0.28.2

SCENARIO:
Install ScreenCapLibrary
Add 'Start Video Recording' to the TestSetup
Add 'Stop Video Recording' to the TestTearDown
Run a simple testcase logging something

RESULT:

  • RF log and report get created (OK)
  • WEBM-file (video) files get created (OK)
  • It doesnt return to the command line. (NOT OK, see picture)
  • when trying to start a 2nd test run, it say 'Can't connect to debugger' (see picture)
    1
@d-biehl d-biehl changed the title RF doesnt return to command line when using RobotCode in combination with ScreenCapLibrary [Bug] Debugger doesnt return to command line when using RobotCode in combination with ScreenCapLibrary Mar 13, 2023
@d-biehl d-biehl added the bug Something isn't working label Mar 13, 2023
@d-biehl d-biehl self-assigned this Mar 13, 2023
@d-biehl
Copy link
Member

d-biehl commented May 15, 2023

ok, I checked and found out that the ScreenCapLibrary is deleting the running ThreadPoolExecutor queues from the Python interpreter.

see here: https://github.com/rticau/ScreenCapLibrary/blob/146304edac5a062a39f6c738a0516212acbd0197/src/ScreenCapLibrary/client.py#L37
and here
https://github.com/rticau/ScreenCapLibrary/blob/146304edac5a062a39f6c738a0516212acbd0197/src/ScreenCapLibrary/client.py#L252

This worked under Python 3.8, because the thread queues were still daemon threads. Daemon threads are simply killed by Python on shutdown.

In new Python version it is tried to shutdown these ThreadPoolExecutor threads reasonable, but because the list of ThreadPoolExecutor threads is empty now, because it is deleted by the ScreenCap library, there are still threads running in the background, which are not terminated correctly.
That's why the debugger hangs, because it also runs ThreadPoolExecutor, but since Python doesn't know that it exists anymore, it won't be terminated.

From my point of view this must be corrected in the ScreenCapLibrary, because it not only affects the RobotCode debugger, but probably also other libraries, I know that the BrowserLibrary also uses ThreadpoolExecutors.

I would prefer not to implement a workaround only for a library that hacks the Python interpreter ;-)

I created an issue in the ScreenCapLibrary project, let's see what happens.

A workaround at the moment is to hack ScreenCapLibrary, just change this line: https://github.com/rticau/ScreenCapLibrary/blob/146304edac5a062a39f6c738a0516212acbd0197/src/ScreenCapLibrary/client.py#L252

like this:

    @staticmethod
    def clear_thread_queues():
        # _threads_queues.clear()
        pass

@Daniwin82
Copy link
Author

Hi Daniel,

Thanks for investigating the issue and for providing a workaround!

Daniel

@d-biehl
Copy link
Member

d-biehl commented Jul 10, 2023

@Daniwin82
Till now I have no answer from the screencaplibrary project, seems a little bit dead.
What is your solution? did you make a fork of the project?
Can I close this issue?

@Daniwin82
Copy link
Author

@d-biehl,

I applied the solution you provided locally. Works for me.
I guess this issue can be closed.

Daniel

@d-biehl
Copy link
Member

d-biehl commented Jul 14, 2023

ok, thanks for feedback!

and maybe you can give this issue a thump up rticau/ScreenCapLibrary#84

@d-biehl d-biehl closed this as completed Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants