Skip to content

Base.active_module() design is very badly broken on master #54888

Closed
@vtjnash

Description

@vtjnash

In addition to existing milestone-blocking issues with Base.active_module function being broken and thread-unsafe, it can also outright crash the session if it gets into a slightly bad state:

[ Info: Precompiling REPLExt [e5eb5ef1-03cf-53a7-ae1d-5a66b08e832b] 
ERROR: TypeError: 
Stacktrace:
  [1] active_module()
    @ REPL ~/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:630
  [2] #invokelatest#2
    @ ./essentials.jl:1045 [inlined]
  [3] invokelatest
    @ ./essentials.jl:1042 [inlined]
  [4] active_module
    @ ./show.jl:519 [inlined]
  [5] 
SYSTEM (REPL): showing an error caused an error
ERROR: TypeError: 
Stacktrace:
  [1] active_module()
    @ REPL ~/julia/usr/share/julia/stdlib/v1.12/REPL/src/REPL.jl:630
  [2] #invokelatest#2
    @ ./essentials.jl:1045 [inlined]
  [3] invokelatest
    @ ./essentials.jl:1042 [inlined]
  [4] active_module
    @ ./show.jl:519 [inlined]
  [5] 
SYSTEM (REPL): caught exception of type TypeError while trying to handle a nested exception; giving up

julia> Base.active_module()

SYSTEM: caught exception of type :TypeError while trying to print a failed Task notice; giving up
ERROR: TaskFailedException
Stacktrace:
  [1] fatal: error thrown and no exception handler available.
TypeError(func=:typeassert, context="", expected=REPL.AbstractREPL, got=REPL.LineEditREPL(t=REPL.Terminals.TTYTerminal(term_type="xterm-256color", in_stream=Base.TTY(handle=0x000000012ef05da0, status=3, buffer=Base.GenericIOBuffer{Memory{UInt8}}(data=Memory{UInt8}(65536, 0x120600048)[0x28, 0x5b, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00
# this keeps printing until the terminal crashes

Metadata

Metadata

Assignees

Labels

regression 1.11Regression in the 1.11 releaseregression 1.12Regression in the 1.12 release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions