Skip to content

IO#fsync doesn't trigger an fsync(2) syscall? #4073

@marktriggs

Description

@marktriggs

Hi there,

When I make a call to IO#fsync on an open file handle, I expected to
see an fsync(2) syscall triggered (as MRI Ruby does), but in the
current JRuby master branch I don't see that.

I'm testing on Linux thweeble 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 GNU/Linux as follows:

 # MRI Ruby
 #
 $ ruby --version
 ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu]

 $ strace -qq -e fsync,fdatasync -f ruby -e 'File.open("/tmp/testfile", "w") do |fh| fh.write("test\n"); fh.fsync; end'
 [pid 13600] fsync(7)                    = 0

 # JRuby built from commit 0ebd63589cf430a171f4224da4226e8c86e52203
 #
 $ strace -qq -e fsync,fdatasync -f java -cp lib/jruby.jar org.jruby.Main -e 'File.open("/tmp/testfile", "w") do |fh| fh.write("test\n"); fh.fsync; end'
 [pid 13702] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
 [pid 13702] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xc} ---
 [pid 13722] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x7ff5988cf700} ---
 [pid 13708] <... futex resumed> )       = ? <unavailable>

Does this seem like a potential bug? I couldn't find any other issues
referencing this.

Thanks!

Mark

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions