Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on 0.6 & 0.7: deprecation warnings in threads #27369

Closed
awllee opened this issue Jun 1, 2018 · 1 comment
Closed

Segmentation fault on 0.6 & 0.7: deprecation warnings in threads #27369

awllee opened this issue Jun 1, 2018 · 1 comment

Comments

@awllee
Copy link

awllee commented Jun 1, 2018

This may be quite low priority, since threads are experimental [although they work very well] and deprecations should be fixed. Nevertheless...

Deprecation warnings in threaded code appear to cause segmentation faults. This is much easier to reproduce if JULIA_NUM_THREADS=4, but the error can still occur with JULIA_NUM_THREADS=2. Replacing the deprecated method with its modern counterpart results in no segmentation faults.

using Compat.LinearAlgebra
import Compat.hasmethod
# no Compat.mul! or Compat.LinearAlgebra.mul!
if VERSION.minor == 6 mul! = A_mul_B! end

function foo1()
  v = method_exists(Base.sin, Tuple{Float64})
  # v = hasmethod(Base.sin, Tuple{Float64})
end

function foo2()
  A = [1.0 2.0; 3.0 4.0]
  b = [1.0;2.0]
  c = [0.0;0.0]
  A_mul_B!(c, A, b)
  # mul!(c, A, b)
end

function foo3()
  v = [1.0;2.0;3.0;4.0]
  log(v)
  # log.(v)
end

function bar(f::F) where F <: Function
  Threads.@threads for i in 1:4
    f()
  end
end

bar(foo1) # sometimes segfaults

bar(foo2) # often segfaults

# bar(foo3) # sometimes segfaults on v0.6.3
@yuyichao
Copy link
Contributor

yuyichao commented Jun 1, 2018

Dup of #14494

@yuyichao yuyichao closed this as completed Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants