This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.sendfile() bo failure on solaris
Type: Stage: resolved
Components: Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, loewis, pitrou, rosslagerwall
Priority: normal Keywords: patch

Created on 2011-02-25 20:03 by giampaolo.rodola, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sendfile-test.patch giampaolo.rodola, 2011-02-25 20:03
test_sendfile.patch pitrou, 2011-02-26 14:16
Messages (5)
msg129411 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-02-25 20:03
http://www.python.org/dev/buildbot/all/builders/sparc%20solaris10%20gcc%203.x/builds/2658/steps/test/logs/stdio

Patch in attachment.
msg129436 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-02-25 21:47
Committed in r88616.
msg129541 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 13:29
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.
msg129550 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 14:16
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.
msg129558 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-02-26 14:39
Should be fixed in r88647.
History
Date User Action Args
2022-04-11 14:57:13adminsetgithub: 55532
2011-02-26 14:39:16pitrousetstatus: open -> closed
versions: + Python 3.3, - Python 3.2
nosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129558

resolution: fixed
stage: patch review -> resolved
2011-02-26 14:16:43pitrousetfiles: + test_sendfile.patch
versions: + Python 3.2, - Python 3.3
nosy: loewis, pitrou, giampaolo.rodola, rosslagerwall
messages: + msg129550

stage: patch review
2011-02-26 13:33:25giampaolo.rodolasetnosy: + rosslagerwall
2011-02-26 13:29:01pitrousetnosy: + pitrou
messages: + msg129541
2011-02-25 21:47:22giampaolo.rodolasetmessages: + msg129436
2011-02-25 20:03:17giampaolo.rodolacreate