Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Blocker Blocker
    • Resolution: Incomplete
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.7.0.pre2
    • Component/s: None
    • Labels:
    • Environment:
      Solaris (SunOS 5.11), jruby 1.7.0.dev (ruby-1.8.7-p357) (2012-01-24 fffffff) (Java HotSpot(TM) Client VM 1.7.0) [SunOS-x86-java]
    • Number of attachments :
      0

      Description

      ... not sure if this is a duplicate; I did search but could not find precisely this issue!

      $ cat stat.rb
      stat = File.stat('testfile.txt')
      puts "#

      {stat.size}

      "

      $ touch testfile
      $ wc -c testfile
      0 testfile
      $ bin/jruby stat.rb
      5701209781360918528

        Issue Links

          Activity

          Hide
          Michael Haupt added a comment -

          Blocker because benchmarks run for ages. For instance, bench_io_read_only.rb reports this:
          100.times { 2849905858983231488.times

          { f.read(1) }

          }

          Show
          Michael Haupt added a comment - Blocker because benchmarks run for ages. For instance, bench_io_read_only.rb reports this: 100.times { 2849905858983231488.times { f.read(1) } }
          Hide
          Charles Oliver Nutter added a comment -

          Hah, that's pretty funny

          A workaround would be to disable native support, in which case we use JVM-friendly APIs to get things like file size... pass -Xnative.enabled=false to JRuby.

          I would get something's a bit off about our Solaris stat structure. Odd that it would suddenly start producing bogus results, though...

          Show
          Charles Oliver Nutter added a comment - Hah, that's pretty funny A workaround would be to disable native support, in which case we use JVM-friendly APIs to get things like file size... pass -Xnative.enabled=false to JRuby. I would get something's a bit off about our Solaris stat structure. Odd that it would suddenly start producing bogus results, though...
          Hide
          Michael Haupt added a comment -

          The offsets seem to be wrong, at least the platform.conf file (and generated .rb files) for i386-solaris get them wrong. This small C program:

          #include <stdio.h>
          #include <sys/stat.h>

          int main(int argc, char** argv)

          { struct stat buf; int res = stat("testfile.txt", &buf); printf("stat answer %d\n", res); printf("stat size %ld\n", buf.st_size); printf("stat addr %p\n", &buf); printf("stat size addr %p\n", &buf.st_size); return 0; }

          gives me addresses for buf and buf.st_size that indicate an offset for st_size of 48, not 52 (as in platform.conf). I did change the value there, but nothing changed; presumably I'm looking in the wrong place. (Totally new to the JRuby code base.)

          Where would the offset have to be corrected?

          Show
          Michael Haupt added a comment - The offsets seem to be wrong, at least the platform.conf file (and generated .rb files) for i386-solaris get them wrong. This small C program: #include <stdio.h> #include <sys/stat.h> int main(int argc, char** argv) { struct stat buf; int res = stat("testfile.txt", &buf); printf("stat answer %d\n", res); printf("stat size %ld\n", buf.st_size); printf("stat addr %p\n", &buf); printf("stat size addr %p\n", &buf.st_size); return 0; } gives me addresses for buf and buf.st_size that indicate an offset for st_size of 48, not 52 (as in platform.conf). I did change the value there, but nothing changed; presumably I'm looking in the wrong place. (Totally new to the JRuby code base.) Where would the offset have to be corrected?
          Hide
          Charles Oliver Nutter added a comment -

          Yet another Solaris FFI bug for 1.7.

          Show
          Charles Oliver Nutter added a comment - Yet another Solaris FFI bug for 1.7.
          Hide
          Charles Oliver Nutter added a comment -

          I believe this will be fixed with Ben Summer's patch for jnr-posix, which chooses the proper stat function to use (stat vs stat64). We'll get that into master soon, but it will go out in pre2. If you are interested in pre-testing, we can try to prioritize getting it in master.

          Show
          Charles Oliver Nutter added a comment - I believe this will be fixed with Ben Summer's patch for jnr-posix, which chooses the proper stat function to use (stat vs stat64). We'll get that into master soon, but it will go out in pre2. If you are interested in pre-testing, we can try to prioritize getting it in master.
          Hide
          Jordan Sissel added a comment -

          A logstash user on solaris 10 also ran into this bug (JRuby 1.6.7.2)

          I can confirm that this bug is fixed in JRuby 1.7.0RC1

          Previously (JRuby 1.6.7.2)

          % java -cp /as/app/logstash/logstash-1.1.2.dev-monolithic.jar org.jruby.Main -e 'p File.stat("/as/data/dsee/keasprod/logs/access")'
          #<File::Stat dev=0x4010014, ino=76222784635264, mode=01, nlink=70015, uid=70013, gid=-1, rdev=0x0, size=5794460174404534443, blksize=2053534464, blocks=0, atime=2012-10-01 16:56:40 -0500, mtime=2012-10-01 16:56:40 -0500, ctime=1970-01-02 06:24:32 -0600>
          

          JRuby 1.7.0RC1

          % java -jar jruby-complete-1.7.0.RC1.jar -e 'p File.stat("/as/data/dsee/keasprod/logs/access")'
          #<File::Stat dev=0x, ino=0, mode=0100644, nlink=, uid=-1, gid=, rdev=0x, size=63794365, blksize=
          
          Show
          Jordan Sissel added a comment - A logstash user on solaris 10 also ran into this bug (JRuby 1.6.7.2) I can confirm that this bug is fixed in JRuby 1.7.0RC1 Previously (JRuby 1.6.7.2) % java -cp /as/app/logstash/logstash-1.1.2.dev-monolithic.jar org.jruby.Main -e 'p File.stat("/as/data/dsee/keasprod/logs/access")' #<File::Stat dev=0x4010014, ino=76222784635264, mode=01, nlink=70015, uid=70013, gid=-1, rdev=0x0, size=5794460174404534443, blksize=2053534464, blocks=0, atime=2012-10-01 16:56:40 -0500, mtime=2012-10-01 16:56:40 -0500, ctime=1970-01-02 06:24:32 -0600> JRuby 1.7.0RC1 % java -jar jruby-complete-1.7.0.RC1.jar -e 'p File.stat("/as/data/dsee/keasprod/logs/access")' #<File::Stat dev=0x, ino=0, mode=0100644, nlink=, uid=-1, gid=, rdev=0x, size=63794365, blksize=

            People

            • Assignee:
              Charles Oliver Nutter
              Reporter:
              Michael Haupt
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: