26

Bug introduced in 10.0 and fixed in 10.1


Warning: the code below may hang your system if you have the Suggestions Bar enabled in Mathematica < 10.1.


When issuing the following simple statements to Mathematica, it responds with a valid answer. However, immediately afterwards one of the two kernels (WolframKernel.exe) goes on a memory frenzy and eats up all RAM, apparently without bounds.

Input:

cols = Table[Symbol[ToString@col <> ToString@row], {col, {a, b, c, d, e, f, g, 
 h, i}}, {row, 9}];
# == 0 & /@ (Times @@@ Table[cols[[1, k]] - j, {k, 9}, {j, 9}])

Output:

{(-9 + a1) (-8 + a1) (-7 + a1) (-6 + a1) (-5 + a1) (-4 + a1) (-3 + a1) (-2 + a1) (-1 + a1) == 0,
 (-9 + a2) (-8 + a2) (-7 + a2) (-6 + a2) (-5 + a2) (-4 + a2) (-3 + a2) (-2 + a2) (-1 + a2) == 0,
 (-9 + a3) (-8 + a3) (-7 + a3) (-6 + a3) (-5 + a3) (-4 + a3) (-3 + a3) (-2 + a3) (-1 + a3) == 0,
 (-9 + a4) (-8 + a4) (-7 + a4) (-6 + a4) (-5 + a4) (-4 + a4) (-3 + a4) (-2 + a4) (-1 + a4) == 0,
 (-9 + a5) (-8 + a5) (-7 + a5) (-6 + a5) (-5 + a5) (-4 + a5) (-3 + a5) (-2 + a5) (-1 + a5) == 0,
 (-9 + a6) (-8 + a6) (-7 + a6) (-6 + a6) (-5 + a6) (-4 + a6) (-3 + a6) (-2 + a6) (-1 + a6) == 0,
 (-9 + a7) (-8 + a7) (-7 + a7) (-6 + a7) (-5 + a7) (-4 + a7) (-3 + a7) (-2 + a7) (-1 + a7) == 0,
 (-9 + a8) (-8 + a8) (-7 + a8) (-6 + a8) (-5 + a8) (-4 + a8) (-3 + a8) (-2 + a8) (-1 + a8) == 0,
 (-9 + a9) (-8 + a9) (-7 + a9) (-6 + a9) (-5 + a9) (-4 + a9) (-3 + a9) (-2 + a9) (-1 + a9) == 0}

Memory consumption is beyond 32GB within a few seconds.

I am running Win8.1x64 with Mathematica 10.0.2.

Interesting sidenote:

Thanks to your kind comments, we found, that this is directly connected to the Suggestion Bar being active.

But: Even after turning it off, the memory consuming behavior can easily be triggered by calling Solve[] on the output: All available system memory and more is consumed within seconds again (not surprisingly, though, since the solution space is $9^9=387,420,489$, if I am not mistaken). So, it might be assumed, that the suggestion bar internally also calls Solve[] on the result, which might give us some more insight into how Mathematica's frontend works.


Using FindInstance[] and ByteCount[] I found, that one solution takes up 12,416 bytes on my machine. Therefore: Should you have 4,810,212,791,424 bytes of RAM to spare (i.e.: > 4.37 TB), you should actually be able to execute a successful Solve[] on that output - and also keep the Suggestion Bar activated. ;)

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Jinxed
  • 3,753
  • 10
  • 24
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Jan 16 '15 at 18:58
  • Cannot repeat the behaviour on 10.01 on linux i386. – Acus Jan 16 '15 at 18:58
  • Please do not use the bugs tag until an issue is either confirmed as a bug by WRI or community consensus is that it is one. This may seem silly in a case that appears to clearly be a bug but there have been times that the problem was shown to be something else. – Mr.Wizard Jan 16 '15 at 19:40
  • No apparent memory leak in 10.0.2 under Windows7-x64. – Mr.Wizard Jan 16 '15 at 19:41
  • 2
    Fails the same way here on a Windows 8.1 64-bit system with 10.0.2.0. Others might not want to repeat this test. It's a little hard to recover. – undefined Jan 16 '15 at 20:27
  • Very close +1- miss for the action-packed title :-) – Yves Klett Jan 16 '15 at 20:48
  • Unable to reproduce issue on Mathematica 10.0.1 on Windows 7 64-bit. Maybe it's a 10.0.2 specific issue? – DumpsterDoofus Jan 16 '15 at 20:51
  • 4
    I can confirm the issue on a Windows 8.1 64-bit system with 10.0.2.0. It happens with the option "Show Suggestion Bar after last output" enabled. It doesn't happen with this option disabled. I definitely think it's a bug, mainly related to the Suggestion Bar, and, potentially, a very bad and dangerous bug. I suggest the poster to report it to Wolfram Support – Luca M Jan 16 '15 at 22:12
  • 2
    OH GOD IT WORKS ON 10.0.1 TOO!!! After enabling "Show Suggestion Bar after last output" as Luca M suggested, it ate all my RAM instantly. – DumpsterDoofus Jan 16 '15 at 22:36
  • @Mr.Wizard Did you try with suggestion bar on? – Sjoerd C. de Vries Jan 16 '15 at 22:41
  • @Sjoerd Of course not; do you take me for a fool? :o) (I think my first action after upgrading from v7 to v10 was to turn off the suggestion bar.) – Mr.Wizard Jan 16 '15 at 23:51
  • It's vitally important that the suggestion bar is turned on for the issue to appear. I could reproduce this issue on Linux with Mathematica 10.0.2. – halirutan Jan 17 '15 at 03:46
  • 1
    Meanwhile, I reported this severe bug to Wolfram. I also confirm the enabled SuggestionBar as trigger for the issue. – Jinxed Jan 17 '15 at 10:39
  • @mr.wizard It doesn't bother me that much. Don't use it often either. It is sometimes useful when playing with graphics and bitmaps. You can disable it on an ad hoc basis if it's really in the way. – Sjoerd C. de Vries Jan 17 '15 at 12:14
  • 3
    "You can disable it on an ad hoc basis if it's really in the way." Or if eats up 32GB of RAM... – dr.blochwave Jan 17 '15 at 15:09
  • @blochwave I was responding to mr.wizard's claim that one would be a fool if one did not disable the bar (when it is working as designed, of course). – Sjoerd C. de Vries Jan 18 '15 at 12:23
  • I can confirm this on OSX 10.8.5 for v10.0.2.0 – gpap Jan 20 '15 at 11:43

1 Answers1

17

Update:

The issue has been fixed in Mathematica 10.1! :)

Besides: Interesting enough, the suggestion bar's first option after evaluating the statements given above now is "solve for …", so: The assumption, that in 10.0.2 Mathematica's suggestion bar started out trying to actually solve for all variables, which, as I pointed out, is quite impossible on a machine with less than a few terabytes of RAM, now really seems what has happened.


Adding up all your kind comments, we can conclude:

  1. An enabled Suggestion Bar (standard in Mathematica 10) triggers one WolframKernel process to consume all system memory (possibly up to approximately 4.37 TB, if available).
  2. This is a bug in Mathematica 10 (up to and including 10.0.2.0) on multiple operating system platforms. Wolfram has confirmed the bug report today (see below).
  3. The only workaround is to disable the Suggestion Bar, until the bug is fixed by Wolfram. Not disabling it might leave you with a nearly stalled operating system doing not much more than massively swapping.
  4. The same (or very much alike) memory consumption will result, even with a disabled Suggestion Bar, should you try to call Solve[], Reduce[] or the like on the output above. Be prepared to manually kill the WolframKernel-process within the next few seconds.

Bug confirmation from Wolfram, 2015-01-19

Hello -
Thank you for your email.
I have reproduced this problem with the Suggestion Bar and 
filed a report with our developers so that it can be fixed 
in a future version of Mathematica.
I will also be sure to pass on any useful information that 
I get in the meantime.
Please let me know if you encounter any further problems 
in Mathematica.
 
[~name masked~]
Technical Support
Wolfram Research, Inc.
http://support.wolfram.com
Jinxed
  • 3,753
  • 10
  • 24