# Segmentation Fault

**URL:** <https://discourse.julialang.org/t/segmentation-fault/29014>\
**Category:** New to Julia\
**Created:** [September 20, 2019, 8:36pm UTC](https://discourse.julialang.org/t/segmentation-fault/29014 "2019-09-20T20:36:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![natgeo-wong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/natgeo-wong/32/10965_2.png) [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Post date:** [September 20, 2019, 8:36pm UTC](https://discourse.julialang.org/t/segmentation-fault/29014/1 "2019-09-20T20:36:45Z")

</div>

Hi All,

I have another confounding error. Basically, I have written up my own module SatPrecip. However, I keep running into the following segmentation fault:

mimicdt() #Note, this is the function that I am calling from SatPrecip

signal (11): Segmentation fault: 11  
in expression starting at none:0  
uv\_write2 at /workspace/srcdir/libuv/src/unix/stream.c:1435  
uv\_write at /workspace/srcdir/libuv/src/unix/stream.c:1530  
jl\_uv\_write at /Users/sabae/buildbot/worker/package\_macos64/build/src/jl\_uv.c:463  
uv\_write\_async at ./stream.jl:907  
uv\_write at ./stream.jl:877  
unsafe\_write at ./stream.jl:931  
#with\_output\_color#674 at ./gcutils.jl:87  
unknown function (ip: 0x11f9cc737)  
#with\_output\_color at ./none:0 [inlined]  
#printstyled#675 at ./util.jl:398 [inlined]  
#printstyled at ./none:0  
emit at /Users/natgeo-wong/.julia/packages/Memento/UgJr2/src/handlers.jl:212  
log at /Users/natgeo-wong/.julia/packages/Memento/UgJr2/src/handlers.jl:46  
log at /Users/natgeo-wong/.julia/packages/Memento/UgJr2/src/loggers.jl:358  
\_log at /Users/natgeo-wong/.julia/packages/Memento/UgJr2/src/loggers.jl:403  
log at /Users/natgeo-wong/.julia/packages/Memento/UgJr2/src/loggers.jl:382 [inlined]  
debug at /Users/natgeo-wong/.julia/packages/Memento/UgJr2/src/loggers.jl:418 [inlined]  
mimicdt at /Users/natgeo-wong/.julia/dev/SatPrecip/src/mimic.jl:17  
do\_call at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:323  
eval\_stmt\_value at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:362 [inlined]  
eval\_body at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:758  
jl\_interpret\_toplevel\_thunk\_callback at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:884  
unknown function (ip: 0xfffffffffffffffe)  
unknown function (ip: 0x12fb9030f)  
unknown function (ip: 0xffffffffffffffff)  
jl\_interpret\_toplevel\_thunk at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:893  
jl\_toplevel\_eval\_flex at /Users/sabae/buildbot/worker/package\_macos64/build/src/toplevel.c:815  
jl\_toplevel\_eval at /Users/sabae/buildbot/worker/package\_macos64/build/src/toplevel.c:824 [inlined]  
jl\_toplevel\_eval\_in at /Users/sabae/buildbot/worker/package\_macos64/build/src/toplevel.c:844  
eval at ./boot.jl:330 [inlined]  
repleval at /Users/natgeo-wong/.julia/packages/Atom/BVajq/src/repl.jl:141  
#174 at /Users/natgeo-wong/.julia/packages/Atom/BVajq/src/repl.jl:163  
with\_logstate at ./logging.jl:395  
with\_logger at ./logging.jl:491 [inlined]  
evalrepl at /Users/natgeo-wong/.julia/packages/Atom/BVajq/src/repl.jl:154  
do\_call at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:323  
eval\_stmt\_value at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:362 [inlined]  
eval\_body at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:758  
jl\_interpret\_toplevel\_thunk\_callback at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:884  
unknown function (ip: 0xfffffffffffffffe)  
unknown function (ip: 0x12fbbbe8f)  
unknown function (ip: 0xffffffffffffffff)  
jl\_interpret\_toplevel\_thunk at /Users/sabae/buildbot/worker/package\_macos64/build/src/interpreter.c:893  
jl\_toplevel\_eval\_flex at /Users/sabae/buildbot/worker/package\_macos64/build/src/toplevel.c:815  
jl\_toplevel\_eval at /Users/sabae/buildbot/worker/package\_macos64/build/src/toplevel.c:824 [inlined]  
jl\_toplevel\_eval\_in at /Users/sabae/buildbot/worker/package\_macos64/build/src/toplevel.c:844  
eval at ./boot.jl:330  
eval\_user\_input at /Users/sabae/buildbot/worker/package\_macos64/build/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:86  
macro expansion at /Users/sabae/buildbot/worker/package\_macos64/build/usr/share/julia/stdlib/v1.2/REPL/src/REPL.jl:118 [inlined]  
#26 at ./task.jl:268  
jl\_apply at /Users/sabae/buildbot/worker/package\_macos64/build/src/./julia.h:1614 [inlined]  
start\_task at /Users/sabae/buildbot/worker/package\_macos64/build/src/task.c:596  
Allocations: 49100619 (Pool: 49091440; Big: 9179); GC: 110

This error goes away when I delete the compiled files in the compiled/ directory, but the next run when I open juno and do:

julia\> using SatPrecip  
[Info: Precompiling SatPrecip [c6577ace-fc08-4973-a1e4-3e4a8afb031d]

julia\> mimicdt()

I run into this error again.

---

<div class="post-metadata">

**Author:** ![natgeo-wong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/natgeo-wong/32/10965_2.png) [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Post date:** [September 20, 2019, 8:39pm UTC](https://discourse.julialang.org/t/segmentation-fault/29014/2 "2019-09-20T20:39:37Z")

</div>

For reference, this is my main module file, SatPrecip.jl:

module SatPrecip

# Main file for the SatPrecip module that downloads precipitation-related

# variables from various satellite instruments

## Modules Used

using Dates, Memento  
using NetCDF  
using Conda, PyCall, PyPlot

## Set Logging Format!

global logger = Memento.config!(“debug”,fmt=“{date} - {level} - {msg}”)

## Exporting the following functions:

export  
mimicdt

## Including other files in the module

include(“mimic.jl”)

end # module

---

<div class="post-metadata">

**Author:** ![natgeo-wong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/natgeo-wong/32/10965_2.png) [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Post date:** [September 20, 2019, 8:40pm UTC](https://discourse.julialang.org/t/segmentation-fault/29014/3 "2019-09-20T20:40:14Z")

</div>

And this is the file mimic.jl from which the function mimicdt() resides:

“”"  
This file contains all the functions that are used in the retrieval of MIMIC  
precipitable water datasets. This includes the downloading and and retrieval  
data from specific areas, as well as plotting of the data.

– mimicdwn(date,region=“GLB”)  
downloads hour gridded precipitable water for a given date (and if  
specified, region)  
– mimicdt(date)  
extracts the year, month and day and generates:  
– a list of files to download  
– the url where the files are to be downloaded from

“”"

function mimicdt()  
debug(logger,“Extracting year, month and day from given date”)  
end
