Conversation
The shell has stopped statements on Ctrl-C since the interrupt landed, but nothing said how long it took, and the answer was forty milliseconds against a budget of fifty. The watcher slept twenty milliseconds between looks and a press pays that twice: once for the wake that reads the flag, once for the wake that finds the statement over. Five leaves ten of the budget for the whole path and costs a compare and a sleep two hundred times a second while a statement runs, which is nothing beside the statement. The progress line is unaffected, since it is written only when the tenth of a second or the row count it prints has changed. Measured now rather than described. The new test gives the shell a pseudoterminal, which is the only way to reach the branch that watches at all, types a statement over twelve thousand people, waits for the progress line so the press lands inside the executor, sends the signal a terminal driver sends, and reads the interrupted line back at eleven milliseconds. It then asks the same session another statement, because a stop that took the session with it would be a different bug wearing this one's answer. The C ABI's stop test grew the same assertion, since the ask there is a call rather than a signal and the return of zu_query is the moment to time against.
20 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shell has stopped a running statement on
Ctrl-Csince the interrupt landed, and the C ABI has answeredzu_conn_interruptfor as long, but neither said how long it took. Under a pseudoterminal the shell took forty milliseconds against a budget of fifty, which is inside it and too close to it to be a number anybody would want to defend on a busy machine.The reason is the watcher's sleep, and a press pays it twice: once for the wake that reads the flag the handler set, and once for the wake that finds the statement over, because the loop only looks between two sleeps. Twenty milliseconds each makes forty. Five makes ten, and costs a compare and a sleep two hundred times a second while a statement is running, which is nothing beside the statement it is waiting for. The progress line does not change either way, since it is written only when the tenth of a second or the row count it prints has changed.
crates/zu-cli/tests/press.rsis the measurement. The shell only watches for a press where standard input is a terminal, so the test gives it one: a pseudoterminal fromposix_openpt, the shell on the far side of it with the editor and the progress line it would have under a person. It types the pairwise statement over twelve thousand people, waits for the progress line so that the press lands on a statement inside the executor rather than one still being parsed, sends the signal a terminal driver sends onCtrl-C, and reads the interrupted line back at eleven milliseconds. Then it asks the same session another statement and gets the count, because a stop that took the session with it would be a different bug wearing this one's answer.The press is a
SIGINTto the child rather than a^Cbyte into the terminal, because that byte only becomes a signal once the driver's signal characters are on and the child is the foreground process group of a controlling terminal, which is session bookkeeping the test would do to arrive at the same signal. Unix only, since Windows has neither this pseudoterminal nor this signal, and the console equivalent is a mechanism the shell does not use yet.The C ABI's stop test grew the same assertion around the call it already made, timing the ask against the return of
zu_query, since there the ask is a call and not a signal.docs/10-api-and-tooling.mdsays the poll rate it now has and where the three gates live.Local gates:
cargo fmt --all --check,cargo clippy --workspace --all-targets --all-features -- -D warnings, andcargo test --workspace --all-features, green.Part of DX2, #168:
Ctrl-Cinterrupts a 10-second query within 50 ms in the shell, in Python, and through the ABI. The Python half is tamnd/zu-python#8, merged.