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

Better debug protocol startup/reconnect handling #176

Open
TwitchBronBron opened this issue Nov 27, 2023 · 0 comments
Open

Better debug protocol startup/reconnect handling #176

TwitchBronBron opened this issue Nov 27, 2023 · 0 comments
Assignees

Comments

@TwitchBronBron
Copy link
Member

Currently, the debug protocol has some issues:

  • the debug protocol doesn't always connect on startup. there seems to be some timing issues, or because we try to connect to the control port every 50ms perhaps we overwhelm the roku.
  • pressing home on the remote will terminate the debug session, even when stopDebuggerOnAppExit is false.
  • Roku OS 12.5 will completely shut down an app when it encounters compile errors in a component library (it didn't do this in prior OS versions). That also results on not seeing any compile errors in complibs when using debug protocol.

Here's the proposed solution:
Change the startup flow for a debug protocol session to do the following:

  • connect to the telnet connection like usual, but leave it alive for the lifetime of the debug session
    • monitor for compile errors the entire time and emit them through the already established means. Luckily for us, the complib compile errors show up in the telnet logs even though the app shuts down
    • remove the "try connect to control port every 50ms" logic in favor of watching the telnet output for this: Waiting for debugger on 192.168.1.33:8081. Here's some sample telnet output.
       11-27 14:24:59.342 [beacon.signal] |AppLaunchInitiate ---------> TimeBase(0 ms)
       11-27 14:24:59.346 [beacon.signal] |AppSplashInitiate ---------> TimeBase(4 ms)
       11-27 14:25:00.063 [beacon.signal] |AppSplashComplete ---------> Duration(716 ms)
       11-27 14:25:00.192 [beacon.signal] |AppLaunchInitiate ---------> TimeBase(0 ms)
       11-27 14:25:00.199 [scrpt.cmpl] Compiling 'Sample Channel One', id 'dev'
       11-27 14:25:00.215 [beacon.signal] |AppCompileComplete --------> Duration(21 ms)
       11-27 14:25:00.735 [scrpt.ctx.run.enter] UI: Entering 'Sample Channel One', id 'dev'
       
       ------ Running dev 'Sample Channel One' main ------
       11-27 14:25:00.742 [plg.dbg.conn.wait] Waiting for debugging connection
       11-27 14:25:00.744 [plg.dbg.conn.wait] Waiting for debugger on 192.168.1.33:8081
       11-27 14:25:10.754 [plg.dbg.conn.timeout] Timeout waiting for connection: using local debugger
       Task took: 791
      
  • if stopDebuggerOnAppExit is set to false, then when the "app exit" event occurs, do not tear down the debug adapter protocol. instead, just tear down the io socket and control port. but keep the telnet connection alive, and keep monitoring for compile errors and the "waiting for debugger...." message, in which case re-launch the control connection and start over.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants