VirtualBox

Ticket #2921 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

sendfile => Fixed in SVN

Reported by: yannk Owned by:
Priority: major Component: shared folders
Version: VirtualBox 2.1.0 Keywords: sendfile linux syscall perlbal vboxsf vboxfs
Cc: Guest type: Linux
Host type: Mac OS X

Description

Hi,

Using Perlbal as a webserver with a document root hosted on a vboxsf mount share, I noticed that no content was sent to the socket, Perlbal was erroring with the following message:

"Error w/ sendfile: Value too large for defined data type"

I believe Perlbal is not the only one impacted by this issue (might be a regression of ticket #819?)

Perlbal has some external dependencies (Sys::Syscall, IO::AIO etc...) that I tried to remove for you. Using perl 5.10 of ubuntu 32bits and the following test script reproduces the error:

#!/usr/bin/perl
use strict;
use warnings;
use Config;
use POSIX;
use IO::Socket::INET;

my $src = shift;
open (my $s, "<$src") or die "cannot open $src";
my $d = open_sock();
doit($s, $d);

sub doit {
    my ($fhs, $fhd) = @_;
    my $src_fd = fileno($fhs);
    my $dst_fd = fileno($fhd);

    my $size = -s $fhs;
    my $SYS_sendfile = 187;
    my $machine = (POSIX::uname())[4];
    unless ($^O eq "linux") {
        die "I don't know if not under linux";
    }
    if ($machine eq "x86_64" && $Config{ptrsize} == 4) {
        $machine = "i386";
    }
    unless ($machine =~ m/^i[3456]86$/) {
        die "I can't tell for $machine";
    }
    my $res = syscall(
        $SYS_sendfile,
        $dst_fd,
        $src_fd,
        0,
        $size,
    );

    if ($res < 0) {
        warn "FAIL: $!";
    }
    else {
        print "SUCCESS\n";
    }
}

sub open_sock {
    my $port = shift ||  9245;
    print "now connect to localhost:$port, thanks\n";
    my $listen = IO::Socket::INET->new(
        Listen    => 1,
        LocalAddr => 'localhost',
        LocalPort => $port,
        Proto     => 'tcp',
        Timeout   => 15,
        ReuseAddr => 1,
    );
    die "problem $!" unless $listen;
    return $listen->accept or die "accept failed";
}


you will need to:

  1. pass a filepath as argument
  2. when instructed connect to the right port using telnet

Broken case: when the filepath is in the vboxsf mount:

yann@dev:~/dev$  perl repro.pl /in/vboxsf
now connect to localhost:9245, thanks
FAIL: Value too large for defined data type at repro2.pl line 40.

Normal case: when the filepath is in the normal filesystem:

yann@dev:~/dev$  perl repro.pl /tmp/src
now connect to localhost:9245, thanks
SUCCESS

here is a strace() of the failing system call:

sendfile(5, 3, NULL, 1497)              = -1 EOVERFLOW (Value too large for defined data type)
write(2, "FAIL: Value too large for define"..., 66FAIL: Value too large for defined data type at repro.pl line 39.
) = 66

here is my mount:

$ mount -t vboxsf  
devel on /home/yann/dev type vboxsf (uid=1000,gid=1000,rw)

$ uname -a
Linux dev 2.6.27-9-server #1 SMP Thu Nov 20 22:53:41 UTC 2008 i686 GNU/Linux

Thanks!

Yann Kerherve

Attachments

vfsmod.c.diff Download (910 bytes) - added by frank 5 years ago.

Change History

comment:1 Changed 5 years ago by matt.bennett

Confirming the same behaviour using nginx as the webserver.

My host is OS X 10.5.5. Guest is Ubuntu 8.04 Server

comment:2 Changed 5 years ago by frank

Just tried out the script with a 2.6.26.8 guest, VBox 2.2.4 additions, works fine here. Is this still an issue?

comment:3 follow-up: ↓ 4 Changed 5 years ago by yannk

It's still an issue:

 ## on a shared folder
 yann@dev:~/dev$ perl 2921.virtualbox.pl /home/yann/dev/xx
 now connect to localhost:9245, thanks
 FAIL: Value too large for defined data type at 2921.virtualbox.pl line 39.

 ## not on a shared folder
 yann@dev:~/dev$ perl 2921.virtualbox.pl /tmp/x
 now connect to localhost:9245, thanks
 SUCCESS

comment:4 in reply to: ↑ 3 ; follow-up: ↓ 5 Changed 5 years ago by yannk

Replying to yannk:

Linux dev 2.6.27-11-server #1 SMP Wed Apr 1 21:53:55 UTC 2009 i686 GNU/Linux vbox 2.2.4 + corresponding Guest Additions

comment:5 in reply to: ↑ 4 Changed 5 years ago by yannk

I tried with v3.0.2 (v3.0.0 wasn't working very well anyway) and it's failing.

FAIL: Value too large for defined data type at 2921.virtualbox.pl line 39.

comment:6 Changed 5 years ago by seanhess

What the status on this bug? I'm experiencing the same thing (although not with the posted script). All I'm doing is trying to get apache or nginx to serve static files. I've tried both and neither work. Nginx dumps this error into the log. Seems like sendfile isn't working to me, although everything else about the shared folders work fine in every other sense.

comment:7 Changed 5 years ago by frank

Should be fixed in r23551. This patch can be applied manually to the file /usr/src/vboxvfs-3.0.6/vfsmod.c (I will attach a proper diff file as well). After that, recompile the guest additions kernel module with /etc/init.d/vboxadd setup and reboot your guest. Your example should work now.

Changed 5 years ago by frank

comment:8 Changed 5 years ago by frank

  • Summary changed from sendfile to sendfile => Fixed in SVN

Note that this fix will not be included in the upcoming 3.0.8 release, it has to wait for the next release. But as said above, everyone which needs that feature can fix it manually.

comment:9 Changed 4 years ago by frank

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use