-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Julia's cp
function apparently cannot read from GPFS file systems. For example, this command
cp("/gpfs/eschnetter/_julia/packages/IJulia/fRegO/deps/logo-32x32.png", "/tmp/q9")
loops forever on my system. It reads from a GPFS file system and writes to a regular (local) file system. I verified that the shell cp
command can copy the file just fine. Calling cp
for files on other file systems also works fine.
Internally, Julia's cp
calls sendfile
, which calls jl_fs_sendfile
:
function sendfile(dst::File, src::File, src_offset::Int64, bytes::Int)
check_open(dst)
check_open(src)
while true
result = ccall(:jl_fs_sendfile, Int32, (OS_HANDLE, OS_HANDLE, Int64, Csize_t),
src.handle, dst.handle, src_offset, bytes)
@show "sendfile" result bytes
uv_error("sendfile", result)
nsent = result
bytes -= nsent
src_offset += nsent
bytes <= 0 && break
end
nothing
end
When I insert a respective @show
command (see above), I see that result=0
while bytes=1310
(its initial value).
This is Julia 1.2, on Ubuntu 16.04, kernel 4.15.0-47-generic.
I suspect that the Linux sendfile
system call fails for GPFS and always returns 0 bytes read, but not indicating a true failure. libuv doesn't handle this case either, and Julia then loops forever. The destination file is created, but remains empty.
If this is correct, then Julia (or libuv) should detect this, and should abort with an error if no bytes were read and no EAGAIN
is indicated. Ideally, Julia (or libuv) would then use a fallback mechanism to copy the file.