2
votes

Instability found in Julia 1.4.1 (2020-04-14). (JuliaPro, 64-bit Windows 10, in Juno).

After 3 hours, I've isolated a few minimum working examples:

using LinearAlgebra
for i in 1:5000000
    [1 2 3; 2 3 4; 3 4 5]
end
print("ONE")
print("TWO")

Sometimes "ONE" will print, and sometimes "ONETWO" will print, after running the same code block repeatedly. Changing the code slightly will still work -- for example:

using LinearAlgebra
for i in 1:1000000
    ones(2,2)-I
end
println("ONE")
println("TWO")

This will usually print only "TWO", but sometimes print both.

It isn't just the LinearAlgebra package, either. I got the same error to work with this code (in a fresh Juno session):

for i in 1:10000000
    [1 1 1; 2 3 4; 1 1 1]
end
println("ONE")
println("TWO")

And with this code:

for i in 1:100000000
    [1]
end
println("ONE")
println("TWO")

It only printed "TWO". Changing the maximum of i will result in print or println breaking more often. E. g., after setting it to 50,000 it might take 20 calls of the loop before seeing only a "TWO" instead of a "ONETWO", but setting it to 100,000,000 it will work almost every time. I also noticed that using ones(x,x) resulted in errors more easily. The inconsistency is the strangest part of the whole thing.

I haven't yet tested a different version of Julia since the website has been giving me trouble for the last few hours, but it would be very interesting to know why this is happening and if it happens for anyone else.

1

1 Answers

1
votes

I managed to replicate this behavior. This looks like a buffering issue in Juno. I guess you can submit this as a bug.

Meanwhile just use flush(stdout) to flush the standard output such as:

for i in 1:10000000
    [1 1 1; 2 3 4; 1 1 1]
end
flush(stdout)
println("ONE")
println("TWO")

Basically, flushing from time to time the standard output in long running jobs is usually quite useful in many cases (e.g. your job suddenly gets interrupted and you want to know when it ended).