-
-
Notifications
You must be signed in to change notification settings - Fork 507
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Hanging Proccesses? #966
Comments
I just ran into the same issue. Same symptoms of the shell hanging for a good few seconds after a command finishes execution (and I suspect this is related to the fact that I recently imported a large Either way, this is pretty annoying and I would consider it pretty much a critical bug (a history augmentation plugin should not get in the way of shell execution but rather do its dirty work in the background — although this seems like a bug to me). If there is anything I could try to get you more debug info, let me know! |
This would be the automated periodic sync running. It's supposed to run in the background. How have you configured your atuin shell installs? That would help narrow down the root cause |
Hey Conrad, I am not quite sure what details you are asking for so here is a general collection of setup details – let me know if you are looking for anything more specific. Versions
Both nushell and atuin were installed with Atuin setupAtuin was initialised by running File contents~/.config/atuin/config.toml## where to store your database, default is your system data directory
## linux/mac: ~/.local/share/atuin/history.db
## windows: %USERPROFILE%/.local/share/atuin/history.db
# db_path = "~/.history.db"
## where to store your encryption key, default is your system data directory
## linux/mac: ~/.local/share/atuin/key
## windows: %USERPROFILE%/.local/share/atuin/key
# key_path = "~/.key"
## where to store your auth session token, default is your system data directory
## linux/mac: ~/.local/share/atuin/session
## windows: %USERPROFILE%/.local/share/atuin/session
# session_path = "~/.session"
## date format used, either "us" or "uk"
# dialect = "us"
## enable or disable automatic sync
auto_sync = true
## enable or disable automatic update checks
# update_check = true
## address of the sync server
sync_address = "https://shell.tibl.dev"
## how often to sync history. note that this is only triggered when a command
## is ran, so sync intervals may well be longer
## set it to 0 to sync after every command
# sync_frequency = "1h"
## which search mode to use
## possible values: prefix, fulltext, fuzzy, skim
# search_mode = "fuzzy"
## which filter mode to use
## possible values: global, host, session, directory
# filter_mode = "global"
## which filter mode to use when atuin is invoked from a shell up-key binding
## the accepted values are identical to those of "filter_mode"
## leave unspecified to use same mode set in "filter_mode"
# filter_mode_shell_up_key_binding = "global"
## which style to use
## possible values: auto, full, compact
# style = "auto"
## the maximum number of lines the interface should take up
## set it to 0 to always go full screen
# inline_height = 0
## enable or disable showing a preview of the selected command
## useful when the command is longer than the terminal width and is cut off
# show_preview = false
## what to do when the escape key is pressed when searching
## possible values: return-original, return-query
# exit_mode = "return-original"
## possible values: emacs, subl
# word_jump_mode = "emacs"
## characters that count as a part of a word
# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
## number of context lines to show when scrolling by pages
# scroll_context_lines = 1
## use ctrl instead of alt as the shortcut modifier key for numerical UI shortcuts
## alt-0 .. alt-9
# ctrl_n_shortcuts = true
## prevent commands matching any of these regexes from being written to history.
## Note that these regular expressions are unanchored, i.e. if they don't start
## with ^ or end with $, they'll match anywhere in the command.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
# history_filter = [
# "^secret-cmd",
# "^innocuous-cmd .*--secret=.+"
# ]
## prevent commands run with cwd matching any of these regexes from being written
## to history. Note that these regular expressions are unanchored, i.e. if they don't
## start with ^ or end with $, they'll match anywhere in CWD.
## For details on the supported regular expression syntax, see
## https://docs.rs/regex/latest/regex/#syntax
# cwd_filter = [
# "^/very/secret/area"
# ]
workspaces = true
show_help = false ~/.local/share/atuin/init.nu# Source this in your ~/.config/nushell/config.nu
$env.ATUIN_SESSION = (atuin uuid)
# Magic token to make sure we don't record commands run by keybindings
let ATUIN_KEYBINDING_TOKEN = $"# (random uuid)"
let _atuin_pre_execution = {||
let cmd = (commandline)
if ($cmd | is-empty) {
return
}
if not ($cmd | str starts-with $ATUIN_KEYBINDING_TOKEN) {
$env.ATUIN_HISTORY_ID = (atuin history start -- $cmd)
}
}
let _atuin_pre_prompt = {||
let last_exit = $env.LAST_EXIT_CODE
if 'ATUIN_HISTORY_ID' not-in $env {
return
}
with-env { RUST_LOG: error } {
atuin history end $'--exit=($last_exit)' -- $env.ATUIN_HISTORY_ID | null
}
}
def _atuin_search_cmd [...flags: string] {
[
$ATUIN_KEYBINDING_TOKEN,
([
`commandline (RUST_LOG=error run-external --redirect-stderr atuin search`,
($flags | append [--interactive, --] | each {|e| $'"($e)"'}),
`(commandline) | complete | $in.stderr | str substring ..-1)`,
] | flatten | str join ' '),
] | str join "\n"
}
$env.config = ($env | default {} config).config
$env.config = ($env.config | default {} hooks)
$env.config = (
$env.config | upsert hooks (
$env.config.hooks
| upsert pre_execution (
$env.config.hooks | get -i pre_execution | default [] | append $_atuin_pre_execution)
| upsert pre_prompt (
$env.config.hooks | get -i pre_prompt | default [] | append $_atuin_pre_prompt)
)
)
$env.config = (
$env.config | upsert keybindings (
$env.config.keybindings
| append {
name: atuin
modifier: control
keycode: char_r
mode: [emacs, vi_normal, vi_insert]
event: { send: executehostcommand cmd: (_atuin_search_cmd) }
}
)
) |
Digging deeper, it looks like the shell process tree consumes 100% CPU (presumably while running the side-effect of cpuload.mov |
Digging into the code, it seems that it is not actually Original Cleaned ( This excludes the |
Yeah, I spotted that too #1263 |
Ah yes, nu, I was looking at the shell init script earlier and it doesn't see we use background processing in nu on end. This means that it will pause while it syncs |
Ok from your logfile I have a bit more context into what's going on here. It looks like your client is attempting to do a full sync everytime. I see 48 I also see that you self host your sync server. Can you confirm what version that's running on? |
Anyway, besides what is causing this issue here I think I'm going to set a 1s timeout on background sync. wdyt @ellie ? |
Ah, I see, for bash the process is deferred as a background task! It seems that nu does not support that natively? I can think of two possible solutions:
P.S.: Is there any particular reason that the sync takes this long and consumes that much CPU? |
I'd go for something more like 3-5s, bearing in mind some setups will have a higher network latency + there's a few calls going on. But it makes sense! |
This is probably the issue here, and I'm unsure if it's an issue with the code or your current setup. If you could confirm whether you're running a tagged release on the server, or a commit sha - and also if there are any error logs on the server. It's usually pretty descriptive if there's something going on that aborts sync. One such example would be where you have a very large history item. The server is generally pretty defensive about this by default, you may wish to configure the size allowed there |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
👋 I found this out a while ago and am playing around with it. However, I noticed some processes are hanging when I switched from zsh to fish.
I just opened a new terminal and typed
ls
before this. It's a bit annoying when I close the terminal tab but are there any solutions to this?The text was updated successfully, but these errors were encountered: