# Kernel shutting down automatically with no error

What are the possible reasons why a kernel exits and the computation simply stops without printing out an error message?

In case the specific scenario is required, it is as follows but perhaps the above question stands on its own --- I have a program (too long to print here, and not sure what the MWE would be) that goes through a loop of files:

1) Read data OpenRead from a moderately sized file (couple of MB), and then close Close the file.

2) Perform some operations using read in data, and output OpenWrite + Write the result to a file whose name is indexed by the loop id; close Close the output file.

After about 1-5% iterations of the loop, the kernel simply exits with no error message. If I restart from the place where it stopped, same thing happens after a while. The output files written in the interim are all okay.

I have checked that the memory usage is minimal (using top on Linux or MaxMemoryUsed[] of Mathematica). What I do notice is that about 300+% of CPU is used during the computation, but that probably is innocuous.

• This probably indicates unexpected behavior at the C++ level. Discovering what this unexpected behavior is will be tough. – b3m2a1 Jul 26 '18 at 0:09
• Have you faced something similar and discovered the cause? If so, what and how? – MvP Jul 26 '18 at 0:17
• It can happen in the neural net framework if you train too much data on CPU. It can happen if you have a CompiledFunction that accidentally dereferences a null pointer. Can't think of too many examples of it happening with OpenRead and friends, assuming you're using Close properly. I'd try to figure out on which file it tends to quit and see if there's something special about that one. – b3m2a1 Jul 26 '18 at 0:21
• It might also be related to how you're reading in/processing your data. What does that look like? – b3m2a1 Jul 26 '18 at 0:22
• I mean, it's an issue and you can report it to Wolfram Tech Support(wolfram.com/support/contact), if you can give them the code which reproduces the issue. They probably won't be able to immediately solve the issue however. – Searke Jul 26 '18 at 14:28