Segmentation fault when using a package, but same code in REPL works fine

Hello everyone,

I am relatively new to julia, and really not sure how to handle a problem with a package I am developing. When I call a function defined in it, I get a segmentation fault. However, if I paste the exact same code into the REPL, it works just fine. Previously, after importing the package I was getting many copies of the error:

jl_uv_writecb() ERROR: operation canceled ECANCELED

but now it loads the package without error, and segfaults after calling one of the package’s functions.

I suspect there is something cached for the package that has been corrupted, but have no idea where to look or how to start fresh.

The code itself can be found at
github.com/safnuk/DIDSON.jl
but I don’t think it is a code issue, as it runs fine on another computer.

Thanks,
Brad

Is precompilation enabled? If so, look for compiled pointers, like a constant bigfloat/bigint in the global scope.

It was enabled, but I took it out to see if it would help resolve the problem (it didn’t). I’m not sure what you mean by compiled pointers. Where do I look for them?

Thanks!

Thanks @ChrisRackauckas - precompilation was the culprit, with the offending pointer coming from

@pyimport numpy as np

Erasing the cache file in ~/.julia/v0.6/pkg.jl and moving the pyimport line into a function fixed the error.

By the way, there’s a suggested solution to this problem in the PyCall.jl readme here: https://github.com/JuliaPy/PyCall.jl#using-pycall-from-julia-modules which will allow you to still have a const global reference to numpy without the danger of segfaulting.