JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.61k stars 5.48k forks source link

Precompiling Bio.jl crashed on recent master branch. #16471

Closed bicycle1885 closed 8 years ago

bicycle1885 commented 8 years ago

Precompiling the master branch of Bio.jl package crashes with segmentation fault. This is reproducible both on OSX and on Linux (logs of Travis CI are here: https://travis-ci.org/BioJulia/Bio.jl/jobs/131278787, https://travis-ci.org/BioJulia/Bio.jl/jobs/131278801). This is also reproducible on my local machine (https://github.com/BioJulia/Bio.jl/issues/191). The smallest reproducing code would be:

julia> Pkg.clone("https://github.com/BioJulia/Bio.jl.git")

julia> using Bio

When I disabled precompile with --compilecache=no flag, the Bio module was successfully loaded.

bicycle1885 commented 8 years ago

Applying the following patch to this commit can suppress the segfault:

diff --git a/src/precompile.jl b/src/precompile.jl
index 7872899..e56127b 100644
--- a/src/precompile.jl
+++ b/src/precompile.jl
@@ -9,9 +9,9 @@ if VERSION < v"0.5-"
     precompile(Base.open, (ASCIIString, Type{Seq.FASTQ},))
     precompile(Base.open, (ASCIIString, Type{Intervals.BED},))
 else
-    precompile(Base.open, (String, Type{Seq.FASTA},))
-    precompile(Base.open, (String, Type{Seq.FASTQ},))
-    precompile(Base.open, (String, Type{Intervals.BED},))
+    #precompile(Base.open, (String, Type{Seq.FASTA},))
+    #precompile(Base.open, (String, Type{Seq.FASTQ},))
+    #precompile(Base.open, (String, Type{Intervals.BED},))
 end
 precompile(Base.read, (Seq.FASTAParser{Seq.BioSequence},))
 precompile(Base.read, (Seq.FASTAParser{Seq.DNASequence},))
Keno commented 8 years ago

This one is quite reproducible. Seems to be a serialization issue (cc @vtjnash maybe):

(rr) list
1614                int ref_only = read_uint8(s);
1615                if (ref_only) {
1616                    jl_module_t *m = (jl_module_t*)jl_deserialize_value(s, NULL);
1617                    jl_sym_t *sym = (jl_sym_t*)jl_deserialize_value(s, NULL);
1618                    jl_datatype_t *dt = (jl_datatype_t*)jl_get_global(m, sym);
1619                    assert(jl_is_datatype(dt));
1620                    jl_value_t *v = (jl_value_t*)dt->name;
1621                    if (usetable)
1622                        backref_list.items[pos] = v;
1623                    return v;
(rr) p jl_(m)
Base
$10 = void
(rr) p jl_(sym)
:#kw##open
$11 = void
(rr) p dt
$12 = (jl_datatype_t *) 0x0
vtjnash commented 8 years ago

It looks like a new type (#kw##open#) was created on-the-fly for Base.#open, which isn't something incremental serialization knows how to handle @JeffBezanson