Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.sendfile() bo failure on solaris #55532

Closed
giampaolo opened this issue Feb 25, 2011 · 5 comments
Closed

os.sendfile() bo failure on solaris #55532

giampaolo opened this issue Feb 25, 2011 · 5 comments

Comments

@giampaolo
Copy link
Contributor

BPO 11323
Nosy @loewis, @pitrou, @giampaolo
Files
  • sendfile-test.patch
  • test_sendfile.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-02-26.14:39:16.146>
    created_at = <Date 2011-02-25.20:03:17.481>
    labels = []
    title = 'os.sendfile() bo failure on solaris'
    updated_at = <Date 2011-02-26.14:39:16.144>
    user = 'https://github.com/giampaolo'

    bugs.python.org fields:

    activity = <Date 2011-02-26.14:39:16.144>
    actor = 'pitrou'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-02-26.14:39:16.146>
    closer = 'pitrou'
    components = []
    creation = <Date 2011-02-25.20:03:17.481>
    creator = 'giampaolo.rodola'
    dependencies = []
    files = ['20892', '20913']
    hgrepos = []
    issue_num = 11323
    keywords = ['patch']
    message_count = 5.0
    messages = ['129411', '129436', '129541', '129550', '129558']
    nosy_count = 4.0
    nosy_names = ['loewis', 'pitrou', 'giampaolo.rodola', 'rosslagerwall']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue11323'
    versions = ['Python 3.3']

    @giampaolo
    Copy link
    Contributor Author

    @giampaolo
    Copy link
    Contributor Author

    Committed in r88616.

    @pitrou
    Copy link
    Member

    pitrou commented Feb 26, 2011

    It still fails under AMD64 OpenIndiana:

    ======================================================================
    ERROR: test_offset_overflow (test.test_os.TestSendfile)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_os.py", line 1473, in test_offset_overflow
        sent = os.sendfile(self.sockno, self.fileno, offset, 4096)
    OSError: [Errno 22] Invalid argument

    ======================================================================
    ERROR: test_send_at_certain_offset (test.test_os.TestSendfile)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_os.py", line 1456, in test_send_at_certain_offset
        sent = self.sendfile_wrapper(self.sockno, self.fileno, offset, nbytes)
      File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_os.py", line 1419, in sendfile_wrapper
        return os.sendfile(sock, file, offset, nbytes)
    OSError: [Errno 22] Invalid argument

    ======================================================================
    ERROR: test_send_whole_file (test.test_os.TestSendfile)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_os.py", line 1436, in test_send_whole_file
        sent = self.sendfile_wrapper(self.sockno, self.fileno, offset, nbytes)
      File "/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/test/test_os.py", line 1419, in sendfile_wrapper
        return os.sendfile(sock, file, offset, nbytes)
    OSError: [Errno 22] Invalid argument

    According to the man page, EINVAL means:

     EINVAL          The offset  cannot  be  represented  by  the
                     off_t  structure,  or the length is negative
                     when cast to ssize_t.
    

    @pitrou
    Copy link
    Member

    pitrou commented Feb 26, 2011

    Ok, so the root cause is that sendfile() under Solaris can fail with EINVAL when the offset is past the end of file (but only on 64-bit builds, strangely :-)). Here is a patch, tested under Linux, 32-bit OpenSolaris and 64-bit OpenSolaris. It also uses a more reasonable data size for the tests, since 10MB makes it annoying to trace problems.

    @pitrou
    Copy link
    Member

    pitrou commented Feb 26, 2011

    Should be fixed in r88647.

    @pitrou pitrou closed this as completed Feb 26, 2011
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants