Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.12k stars 107 forks source link

The kernel dies when using variables with different registers. #44

Open devcrocod opened 4 years ago

devcrocod commented 4 years ago

The kernel dies when the following code is executed:

fun stack(vararg tup: Int): Int = tup.sum()
val X = 1
val x = stack(1, X)

In this case, the code is executed if you use other names for X or x.

The error itself is as follows:

java.lang.IllegalStateException: Aggregated history sizes mismatch: 3 != 2
    at org.jetbrains.kotlin.cli.common.repl.AggregatedReplStateHistory.assertSameSize(AggregatedReplState.kt:75)
    at org.jetbrains.kotlin.cli.common.repl.AggregatedReplStateHistory.get(AggregatedReplState.kt:41)
    at org.jetbrains.kotlin.cli.common.repl.AggregatedReplStateHistory.get(AggregatedReplState.kt:23)
    at kotlin.collections.AbstractList$IteratorImpl.next(AbstractList.kt:78)
    at org.jetbrains.kotlin.jupyter.repl.reflect.ContextUpdater.getLines(ContextUpdater.kt:131)
    at org.jetbrains.kotlin.jupyter.repl.reflect.ContextUpdater.update(ContextUpdater.kt:30)
    at org.jetbrains.kotlin.jupyter.ReplForJupyter.doEval(repl.kt:269)
    at org.jetbrains.kotlin.jupyter.ReplForJupyter.eval(repl.kt:201)
    at org.jetbrains.kotlin.jupyter.ProtocolKt$shellMessagesHandler$res$1.invoke(protocol.kt:87)
    at org.jetbrains.kotlin.jupyter.ProtocolKt$shellMessagesHandler$res$1.invoke(protocol.kt)
    at org.jetbrains.kotlin.jupyter.ProtocolKt.evalWithIO(protocol.kt:279)
    at org.jetbrains.kotlin.jupyter.ProtocolKt.shellMessagesHandler(protocol.kt:86)
    at org.jetbrains.kotlin.jupyter.IkotlinKt.kernelServer(ikotlin.kt:104)
    at org.jetbrains.kotlin.jupyter.IkotlinKt.main(ikotlin.kt:59)
Exception in thread "Thread-3" org.zeromq.ZMQException: Errno 156384765 : Context was terminated
    at org.zeromq.ZMQ$Socket.mayRaise(ZMQ.java:1456)
    at org.zeromq.ZMQ$Socket.recv(ZMQ.java:1365)
    at org.jetbrains.kotlin.jupyter.IkotlinKt$kernelServer$$inlined$use$lambda$1.invoke(ikotlin.kt:123)
    at org.jetbrains.kotlin.jupyter.IkotlinKt$kernelServer$$inlined$use$lambda$1.invoke(ikotlin.kt)
    at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

I got this error using latest kernel versions - 0.7.40.145 and 0.7.41.190. There was no such error on the old version. As far as I remember it was version 0.7.12.

ileasile commented 4 years ago

YouTrack issue: https://youtrack.jetbrains.com/issue/KT-36397