JuliaIO / FileIO.jl

Main Package for IO, loading all different kind of files
http://juliaio.github.io/FileIO.jl/
Other
216 stars 78 forks source link

No applicable_loaders found for UNKNOWN #342

Open P4ul-J opened 3 years ago

P4ul-J commented 3 years ago

I want to loop over the following code in an IJulia notebook:

using Images,FileWatching
event = watch_file("test.png")
if event.timedout
    display("timeout")
end
display(load("test.png"))

The first execution works as expected, however, during the second execution I get the following error message

No applicable_loaders found for UNKNOWN

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] applicable_loaders
   @ ~/.julia/packages/FileIO/40aie/src/loadsave.jl:11 [inlined]
 [3] load(::String; options::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/40aie/src/loadsave.jl:112
 [4] load(::String)
   @ FileIO ~/.julia/packages/FileIO/40aie/src/loadsave.jl:110
 [5] top-level scope
   @ In[7]:6
 [6] eval
   @ ./boot.jl:360 [inlined]
 [7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1094

and after executing the code yet another time additionally the following

┌ Error: There was an error in magic function detect_rdata.
│ Please open an issue at FileIO.jl.
│   exception = (EOFError(), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x0000000116cf51a4, Ptr{Nothing} @0x000000011303fc78, Ptr{Nothing} @0x000000011303fe6f, Ptr{Nothing} @0x000000010a0b09ef, Ptr{Nothing} @0x0000000113013cf9, Ptr{Nothing} @0x00000001130146d7, Ptr{Nothing} @0x00000001130155fa, Ptr{Nothing} @0x00000001130157c8, Ptr{Nothing} @0x0000000113015999, Ptr{Nothing} @0x0000000113010e44, Ptr{Nothing} @0x0000000113012a69, Ptr{Nothing} @0x0000000113012cfe, Ptr{Nothing} @0x000000010a0b09ef, Ptr{Nothing} @0x000000010a0c773f, Ptr{Nothing} @0x000000010a0c6094, Ptr{Nothing} @0x000000010a0c640c, Base.InterpreterIP in top-level CodeInfo for Main at statement 0, Ptr{Nothing} @0x000000010a0e0d44, Ptr{Nothing} @0x000000010a0e0b04, Ptr{Nothing} @0x000000010a0e1634, Ptr{Nothing} @0x0000000112ff009c, Ptr{Nothing} @0x0000000112ff04f9, Ptr{Nothing} @0x000000010a0b09ef, Ptr{Nothing} @0x0000000112ffe855, Ptr{Nothing} @0x000000010a0b09ef, Ptr{Nothing} @0x000000010a0bd269, Ptr{Nothing} @0x0000000112fdeb62, Ptr{Nothing} @0x0000000112fdeed4, Ptr{Nothing} @0x0000000112fdeeec, Ptr{Nothing} @0x000000010a0b09ef, Ptr{Nothing} @0x000000010a0cba7d])
└ @ FileIO /Users/paul/.julia/packages/FileIO/40aie/src/query.jl:145

I'm using Julia 1.6 and Images v0.24.1.

P4ul-J commented 3 years ago

I can reproduce the same error in the REPL. By the way, the image is overwritten after launch and results in the event FileWatching.FileEvent(false, true, false).

johnnychen94 commented 3 years ago

I'm not clear how test.png is changed so can't reproduce it faithfully.

It seems that there is some data race happening here. IIUC from the description, a file is changed doesn't necessarily mean the file is complete. Maybe we need a higher-level API on watch_file to deal with the data racing issue, e.g., on_file_change(file; callback). In this case, callback = file->display(load(file)).

The detect_rdata issue is related to #338

johnnychen94 commented 3 years ago

The error message might be different for FileIO v1.10.