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

Refresh stale file handles for REPL history. #44999

Merged
merged 1 commit into from
May 9, 2022

Conversation

marmarelis
Copy link
Contributor

Often, when running multiple Julia REPLs on a Linux cluster with network-mounted home directories, the REPL's history file handle becomes stale and each new line errors out with the following:

┌ Error: Error in the keymap
│   exception =
│    SystemError: seekend: Stale file handle
│    Stacktrace:
│      [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
│        @ Base ./error.jl:168
│      [2] #systemerror#62
│        @ ./error.jl:167 [inlined]
│      [3] systemerror
│        @ ./error.jl:167 [inlined]
│      [4] seekend(s::IOStream)
│        @ Base ./iostream.jl:163
│      [5] add_history(hist::REPL.REPLHistoryProvider, s::REPL.LineEdit.PromptState)
│        @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:562
│      [6] add_history(s::REPL.LineEdit.PromptState)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:1248
│      [7] add_history(::REPL.LineEdit.MIState)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:227
│      [8] commit_line(s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2081
│      [9] (::REPL.LineEdit.var"#110#163")(::REPL.LineEdit.MIState, ::Any, ::Vararg{Any, N} where N)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2163
│     [10] #invokelatest#2
│        @ ./essentials.jl:708 [inlined]
│     [11] invokelatest
│        @ ./essentials.jl:706 [inlined]
│     [12] (::REPL.LineEdit.var"#22#23"{REPL.LineEdit.var"#110#163", String})(s::Any, p::Any)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:1414
│     [13] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2534
│     [14] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
│        @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2436
│     [15] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
│        @ REPL /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
│     [16] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
│        @ REPL ./task.jl:406
└ @ REPL.LineEdit /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2536

I introduced a small fix to attempt reopening the file after a SystemError, thus refreshing the handle. This is my first time contributing so all feedback is welcome.

@giordano giordano added the REPL Julia's REPL (Read Eval Print Loop) label Apr 15, 2022
@KristofferC KristofferC merged commit d3fdde9 into JuliaLang:master May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants