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

Notebook hangs when top-level variable modified repeatedly #996

Open
ajrnz opened this issue Oct 13, 2022 · 0 comments
Open

Notebook hangs when top-level variable modified repeatedly #996

ajrnz opened this issue Oct 13, 2022 · 0 comments

Comments

@ajrnz
Copy link

ajrnz commented Oct 13, 2022

Create a notebook with two cells (two cells are required):

var funcCount = 0L

def fastLoop() = {
  funcCount += 1
}

and

for(i <- Iterator.range(0,1000)) {
  fastLoop()
}

Evaluate the first cell once and then the second cell several times. It will hang after a few tries (or just make the number bigger).

I'm not exactly sure what is happening but it appears that the kernel is generating lots of messages when the variable is modified and something is breaking under the hood to do with queues. I've seen the messages of the form

2022-10-13 12:37:49.737 ServerApp] IOPub message rate exceeded.

but increasing ServerApp.iopub_msg_rate_limit didn't solve the problem. Either way, this should not be generating any messages or it will result in a significant performance problem (which is how I came across it).

If I replace the top-level variable with a class and modify a member the problem goes away.
If I put both statements in the same cell the problem goes away.

Maybe related to #549 and #768

Tested under:
Almond 0.13.1
Ammonite 2.5.4-13-1ebd00a6
Scala 2.13.8
Java 8 & 17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant