Repository navigation
discard pending console output on interrupt - #12061
kevinushey wants to merge 4 commits into
Conversation
|
A concern I have about this fix is that it's designed for this specific test case, where all pending console output is not important. If we use transactional semantics, when pressing 'stop', I'd expect to see any pending console output that was generated before I pressed stop and here that all gets discarded. Perhaps the real problem here is that we can create an arbitrarily long buffer of console output events. There's a fixed cost for each one and we have no way to bound the latency debt that's created when a program is spewing output as fast as it can. Do we have code to merge console output events on the server side, and somehow join them together on the client if they are coming faster than we can process? That would allow us to overall handle more console output events. As a second measure, we could have a max pending console output setting and discard the oldest output when more than that comes in. That way, we'd always have the most recent output right up until the 'stop' was pressed but wouldn't let the latency get too long. |
We don't, but that's a good idea. It also raises the question of "why does it take the client so long to process console output?" and it seems like the majority of time is just spent counting lines: It looks like we're counting lines here using a plain regular expression, so we could almost surely do better with a plain loop using rstudio/src/gwt/src/org/rstudio/core/client/dom/DomUtils.java Lines 226 to 272 in 21efc97 It's also probably slow to count lines in the text nodes themselves rather on the strings we're getting from the server; it's worth exploring if we can alleviate that cost as well. I'll try to see if we can make progress with those before dropping potential output. Thank you! |
|
Superceded by #12077. |

Intent
Addresses #12059.
Approach
Relatively straightforward wiring of callbacks into our existing interrupt handlers:
rConsoleInterruptedcallback sends a client event notifying that an interrupt was sent,Automated Tests
Not included.
QA Notes
Test via notes in #12059.
Checklist
NEWS.md