Repository navigation
test_socket generates several warnings #110012
Copy link
Copy link
Open
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-socketRelated to the socket, socketserver and selectors modulesRelated to the socket, socketserver and selectors modulestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Repro: ./python.exe -We -m test test_socket -v
======================================================================
ERROR: testSecondCmsgTruncInData (test.test_socket.RecvmsgIntoRFC3542AncillaryUDP6Test.testSecondCmsgTruncInData)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 4324, in testSecondCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2940, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testSingleCmsgTruncInData (test.test_socket.RecvmsgIntoRFC3542AncillaryUDP6Test.testSingleCmsgTruncInData)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 4220, in testSingleCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2940, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen0 (test.test_socket.RecvmsgIntoSCMRightsStreamTest.testCmsgTruncLen0)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3897, in testCmsgTruncLen0
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0), maxdata=0)
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2940, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen0Plus1 (test.test_socket.RecvmsgIntoSCMRightsStreamTest.testCmsgTruncLen0Plus1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3903, in testCmsgTruncLen0Plus1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0) + 1, maxdata=1)
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2940, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen1 (test.test_socket.RecvmsgIntoSCMRightsStreamTest.testCmsgTruncLen1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3909, in testCmsgTruncLen1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(SIZEOF_INT),
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2940, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen2Minus1 (test.test_socket.RecvmsgIntoSCMRightsStreamTest.testCmsgTruncLen2Minus1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3916, in testCmsgTruncLen2Minus1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(2 * SIZEOF_INT) - 1,
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2940, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testSecondCmsgTruncInData (test.test_socket.RecvmsgRFC3542AncillaryUDP6Test.testSecondCmsgTruncInData)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 4324, in testSecondCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2849, in doRecvmsg
result = sock.recvmsg(bufsize, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testSingleCmsgTruncInData (test.test_socket.RecvmsgRFC3542AncillaryUDP6Test.testSingleCmsgTruncInData)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 4220, in testSingleCmsgTruncInData
msg, ancdata, flags, addr = self.doRecvmsg(
^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2849, in doRecvmsg
result = sock.recvmsg(bufsize, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen0 (test.test_socket.RecvmsgSCMRightsStreamTest.testCmsgTruncLen0)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3897, in testCmsgTruncLen0
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0), maxdata=0)
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2849, in doRecvmsg
result = sock.recvmsg(bufsize, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen0Plus1 (test.test_socket.RecvmsgSCMRightsStreamTest.testCmsgTruncLen0Plus1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3903, in testCmsgTruncLen0Plus1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(0) + 1, maxdata=1)
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2849, in doRecvmsg
result = sock.recvmsg(bufsize, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen1 (test.test_socket.RecvmsgSCMRightsStreamTest.testCmsgTruncLen1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3909, in testCmsgTruncLen1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(SIZEOF_INT),
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2849, in doRecvmsg
result = sock.recvmsg(bufsize, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
======================================================================
ERROR: testCmsgTruncLen2Minus1 (test.test_socket.RecvmsgSCMRightsStreamTest.testCmsgTruncLen2Minus1)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3916, in testCmsgTruncLen2Minus1
self.checkTruncatedArray(ancbuf=socket.CMSG_LEN(2 * SIZEOF_INT) - 1,
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 3877, in checkTruncatedArray
msg, ancdata, flags, addr = self.doRecvmsg(self.serv_sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sobolev/Desktop/cpython/Lib/test/test_socket.py", line 2849, in doRecvmsg
result = sock.recvmsg(bufsize, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeWarning: received malformed or improperly-truncated ancillary data
----------------------------------------------------------------------
Ran 483 tests in 27.924s
FAILED (errors=12, skipped=245)
test test_socket failed
test_socket failed (12 errors)
== Tests result: FAILURE ==
1 test failed:
test_socket
Total duration: 28.0 sec
Total tests: run=483 skipped=245
Total test files: run=1/1 failed=1
Result: FAILURE
I have a fix ready.
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtopic-socketRelated to the socket, socketserver and selectors modulesRelated to the socket, socketserver and selectors modulestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
pythongh-110012: Fix `RuntimeWarning` in `test_socket`
serhiy-storchaka commentedon Sep 29, 2023
These three methods that potentially emit a warning generate 18 tests in total.
But only 12 of them are failed above. Are they always the same tests? What is the difference between tests that passed and tests that failed? Or was they skipped? Try to run only these test (
-m testSingleCmsgTruncInData -m testSecondCmsgTruncInData -m 'testCmsgTruncLen*').sobolevn commentedon Nov 20, 2024
Only two warnings are left: