Update: Try to reproduce this behaviour with CellGrouping set to manual. To do that:

  • either evaluate SetOptions[$FrontEnd, CellGrouping -> Manual],
  • or hit CTRL+SHIFT+O to bring up the Option Inspector window, Lookup (among Global preferences) the option CellGrouping and set it to Manual.

Please test whether the phenomen is reproducible for you with the changed setting. You can reset cell grouping to its default behaviour by:

SetOptions[$FrontEnd, CellGrouping -> Automatic]

Strangest bug ever. Copy the following piece of code to the same notebook two times, below each other, as two identical cells. Be sure to run a fresh kernel.

DynamicModule[{x}, Print[1]; Dynamic@x, Initialization :> Print[2]]

Now evaluate the second cell. Fine, it returns and prints stuff.

Mathematica graphics

And now, without quitting the kernel, evaluate the first cell. It crashes Mathematica. Every time, and only when the first cell is evaluated. If (after a restart) I only evaluate the first cell, Mathematica crashes again.

How come that the outcome of evaluating two identical cells depends on whether the cell is the last one or not?

Furthermore, this one causes a crash on its own:

DynamicModule[{x}, Dynamic@x, Initialization :> Print[2]]

Mathematica Windows 7 (64-bit), no packages, problem persists after full reboot, suggestion bar is turned off.

  • $\begingroup$ No crash here. works fine. !Mathematica graphics please say which platform and version you are using when reporting possible errors. I am on windows 7, 64 bit, V 9.01 $\endgroup$
    – Nasser
    Dec 6, 2013 at 14:55
  • $\begingroup$ Can't reproduce it in 9.0.1 on Windows 7 x64. The FE code differs substantially between platforms--which one are you on? $\endgroup$ Dec 6, 2013 at 14:56
  • $\begingroup$ Does not crash (MMA 9.0.1 Win7 64). Although I find it a bit strange that 1 gets printed before 2:) $\endgroup$
    – Ajasja
    Dec 6, 2013 at 15:23
  • $\begingroup$ @Ajasja You shouldn't: Initialization code is only evaluated after the return value of the DynamicModule is displayed (see here). $\endgroup$ Dec 6, 2013 at 15:35
  • $\begingroup$ Same behaviour for me, W7 32b MMA 9.0.1 here $\endgroup$
    – Öskå
    Dec 6, 2013 at 15:36

1 Answer 1


Tech Support kindly answered and acknowledged the crash:

The crash is now reproducible after setting the option CellGrouping -> Manual. I have forwarded it to the developers for further investigation. You will be informed when a fix is made available.

You can turn off manual CellGrouping with:

SetOptions[$FrontEnd, CellGrouping -> Automatic]

Also, restarting Mathematica in clean mode resets everything including cell grouping behaviour to defaults and the two cells behave normally. The documentation states:

mathematica.exe -clean: ignore stored caches and rebuild the front end preferences file

(It also seems like from the documentation that this is a Mac-only option, but it also applies to Win.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.