Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Undefined struct field type causes process crash

Open PatrickHaecker opened this issue 7 months ago • 7 comments

With Julia 1.11.4 and Pluto v0.20.5 I think when one cell was using broken syntax, the other (independent) cells still worked. With Julia 1.11.5 and Pluto v0.20.6 one broken cell seems to crash the Pluto process and therefore no cell works anymore.

This takes time because the document needs to be calculated from scratch.

I know this is not much, because I am in the middle of something, and therefore do not have a reproducer, but it seemed to happen when using undefined types in structs.

I hope I can complete the report when I have something to work with.

PatrickHaecker avatar Apr 17 '25 14:04 PatrickHaecker

In this case, the cell with the field with the undefined type gets an UndefVarError and all the other cells get an InterruptException: or sometimes a Malt.TerminatedWorkerException().

PatrickHaecker avatar Apr 18 '25 03:04 PatrickHaecker

Ok, I think I boiled it down. The crash can simply be activated and deactivated. This is with Julia 1.11.5:

### A Pluto.jl notebook ###
# v0.20.6

using Markdown
using InteractiveUtils

# ╔═╡ 0f5b68f4-19bd-4bf0-9c57-0f2df367f080
struct MyName
	distance::Int
	index::Int # If `Int` is changed into `MyError`, Pluto crashes
end

# ╔═╡ 01340cee-5835-4549-9cbd-950db8f6614f
MyName |> sizeof

# ╔═╡ Cell order:
# ╠═0f5b68f4-19bd-4bf0-9c57-0f2df367f080
# ╠═01340cee-5835-4549-9cbd-950db8f6614f

PatrickHaecker avatar Apr 21 '25 07:04 PatrickHaecker

@PatrickHaecker Can you write a regular bug report?

Clearly state:

  • what did you do? which steps should i follow?
  • what did you see? and what did you expect to see and why?

videos and screenshots help a lot.

fonsp avatar Apr 21 '25 12:04 fonsp

And thanks for finding which Julia+Pluto version caused it. Can you find out which of the two (julia or pluto update) is the culprit?

fonsp avatar Apr 21 '25 12:04 fonsp

Steps to reproduce:

  1. Create new Pluto notebook (or empty an existing one)
  2. Create a cell with the following content:
struct MyName
	distance::Int
	index::Int # If `Int` is changed into `MyError`, Pluto crashes
end
  1. Create another cell with the following content:
MyName |> sizeof
  1. Change the type of the index field into MyError
  2. Hit Ctrl+s
  3. Watch the Pluto process crashing

Crash happens for Julia 1.11.5 and Pluto 0.20.6 Crash happens for Julia 1.11.4 and Pluto 0.20.6 Crash happens for Julia 1.11.4 and Pluto 0.20.5 Crash happens for Julia 1.11.4 and Pluto 0.20.1

I weren't able to test Julia 1.11.4 and Pluto 0.19.1 as they didn't work together. I weren't able to test Julia 1.11.5 and Pluto 0.20.5 as they didn't work together.

So it does not seem to be so easy to see which version introduced it and the problem exists for longer than I had experienced. But hopefully the test case is so simple, that regular debugging leads to the root cause.

PatrickHaecker avatar Apr 22 '25 11:04 PatrickHaecker

Thanks! It seems to be broken for all Julia + Pluto versions.

I noticed that the crash happens only once you run a second cell that references MyName. Just running the struct definition does not break.

fonsp avatar Apr 23 '25 12:04 fonsp

Yes, that matches my observations.

And that is probably the reason I initially thought it would have to do with a Julia/Pluto update. Probably I introduced some of these references around the same time I updated Julia/Pluto and I only observed the crashes the first time with the updated version, although the problem would have occurred independent of the update.

PatrickHaecker avatar Apr 24 '25 05:04 PatrickHaecker