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

REPL: use @async to run repl keymap etc. not @spawn :interactive #57730

Closed

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Mar 11, 2025

The execution of regular user input happens outside of this scope, but if the user pastes in multiple prompts then those prompts are executed within these tasks.

On a system with no interactive pool, but a > 1 default one, @spawn :interactive has free reign to schedule onto any :default thread. (Perhaps it shouldn't and just spawn onto 1??)

Some user code doesn't like being run on threads other than the main thread, like GLFW, so weird errors can happen when code is pasted in that doesn't happen otherwise, so this reverts these back to @async.

The main task is already sticky for many reasons, so I don't think this is a loss.

@IanButterworth IanButterworth added REPL Julia's REPL (Read Eval Print Loop) backport 1.12 Change should be backported to release-1.12 labels Mar 11, 2025
@vtjnash
Copy link
Member

vtjnash commented Mar 11, 2025

Some user code doesn't like being run on threads other than the main thread

We previously defined that all user code executes on the original root Task (because some libraries get unhappy if you aren't running them on the main Task). Did that get broken here? There is no reason this should not be using @spawn, since all execution and printing should be managed via Channels back to the frontend Task.

@IanButterworth
Copy link
Member Author

During bracketed paste that doesn't happen

@invokelatest LineEdit.mode(s).on_done(s, LineEdit.buffer(s), true)

@vtjnash
Copy link
Member

vtjnash commented Mar 11, 2025

That is not user code though. The user code happens later:

response = eval_with_backend(ast, backend(repl))

@IanButterworth
Copy link
Member Author

This isn't right, I've opened an issue on the 1.12 milestone with @vtjnash's suggestion from slack #57742

@IanButterworth IanButterworth deleted the ib/repl_async branch March 12, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.12 Change should be backported to release-1.12 REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants