commit | b349949b516eb7328bf637196abb6f8a2d69b675 | [log] [tgz] |
---|---|---|
author | Sabrina Dubroca <sdubroca@redhat.com> | Tue Jun 13 16:48:46 2017 +0200 |
committer | Jan Stancek <jstancek@redhat.com> | Wed Jun 14 16:53:05 2017 +0200 |
tree | 4cb9104cf0a0184d030e7ae5a18b41c8639be213 | |
parent | e59c0a09a31fc6adc3bda0d1dc30c01d45fcabf6 [diff] |
recvmsg03: avoid close() and recvmsg() racing This testcase rarely hangs on single CPU systems. Problem appears to be between recvmsg() and close(): 1. sendmsg(), packet gets queued 2. close(), packet is dropped 3. recvmsg(), nothing to fetch strace of a buggy run: [pid 17284] 16:04:41.042617 socket(AF_RDS, SOCK_SEQPACKET, 0) = 3 [pid 17284] 16:04:41.049549 close(3) = 0 strace: Process 17290 attached [pid 17284] 16:04:41.050765 socket(AF_RDS, SOCK_SEQPACKET, 0 <unfinished ...> [pid 17290] 16:04:41.050894 futex(0x7f95dfc57014, FUTEX_WAIT, 0, {tv_sec=10, tv_nsec=0} <unfinished ...> [pid 17284] 16:04:41.051001 <... socket resumed> ) = 3 [pid 17284] 16:04:41.051111 bind(3, {sa_family=AF_INET, sin_port=htons(4000), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 [pid 17284] 16:04:41.051374 futex(0x7f95dfc57014, FUTEX_WAKE, 2147483647) = 1 [pid 17290] 16:04:41.051432 <... futex resumed> ) = 0 [pid 17284] 16:04:41.051442 recvmsg(3, <unfinished ...> [pid 17290] 16:04:41.051455 socket(AF_RDS, SOCK_SEQPACKET, 0) = 3 [pid 17290] 16:04:41.051666 bind(3, {sa_family=AF_INET, sin_port=htons(4001), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 [pid 17290] 16:04:41.051724 sendmsg(3, {msg_name={sa_family=AF_INET, sin_port=htons(4000), sin_addr=inet_addr("127.0.0.1")}, msg_namelen=16, msg_iov=[{iov_base="hello world\0", iov_len=12}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 12 [pid 17290] 16:04:41.051975 close(3) = 0 [pid 17290] 16:04:41.052492 +++ exited with 0 +++ [pid 17284] 16:04:41.052598 <... recvmsg resumed> {msg_namelen=32}, 0) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) [pid 17284] 16:04:41.052631 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17290, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- [pid 17284] 16:04:41.052718 recvmsg(3, // hang Signed-off-by: Sabrina Dubroca <sdubroca@redhat.com> [ wrote changelog message ] Acked-by: Jan Stancek <jstancek@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
Linux Test Project is a joint project started by SGI, OSDL and Bull developed and maintained by IBM, Cisco, Fujitsu, SUSE, Red Hat, Oracle and others. The project goal is to deliver tests to the open source community that validate the reliability, robustness, and stability of Linux.
The LTP testsuite contains a collection of tools for testing the Linux kernel and related features. Our goal is to improve the Linux kernel and system libraries by bringing test automation to the testing effort. Interested open source contributors are encouraged to join.
Project pages are located at: http://linux-test-project.github.io/
The latest image is always available at: https://github.com/linux-test-project/ltp/releases
The discussion about the project happens at ltp mailing list: http://lists.linux.it/listinfo/ltp
The git repository is located at GitHub at: https://github.com/linux-test-project/ltp
Be careful with these tests!
Don't run them on production systems. Growfiles, doio, and iogen in particular stress the I/O capabilities of systems and while they should not cause problems on properly functioning systems, they are intended to find (or cause) problems.
If you have git, autoconf, automake, m4, the linux headers and the common developer packages installed, the chances are the following will work.
$ git clone https://github.com/the-linux-test-project/ltp.git $ cd ltp $ make autotools $ ./configure $ make $ make install
This will install LTP to /opt/ltp
.
doc/mini-howto-building-ltp-from-git.txt
.INSTALL
and ./configure --help
.Some tests will be disabled if the configure script can not find their build dependencies.
TCONF
due to a missing component, check the ./configure
output.INSTALL
.To run all the test suites
$ cd /opt/ltp $ ./runltp
Note that many test cases have to be executed as root.
To run a particular test suite
$ ./runltp -f syscalls
To run all tests with madvise
in the name
$ ./runltp -f syscalls -s madvise
Also see
$ ./runltp --help
Test suites (e.g. syscalls) are defined in the runtest directory. Each file contains a list of test cases in a simple format, see doc/ltp-run-files.txt.
Each test case has its own executable or script, these can be executed directly
$ testcases/bin/abort01
Some have arguments
$ testcases/bin/fork13 -i 37
The vast majority of test cases accept the -h (help) switch
$ testcases/bin/ioctl01 -h
Many require certain environment variables to be set
$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
Most commonly, the path variable needs to be set and also LTPROOT
, but there are a number of other variables, runltp
usually sets these for you.
Note that all shell scripts need the PATH
to be set. However this is not limited to shell scripts, many C based tests need environment variables as well.
Before you start you should read following documents:
doc/test-writing-guidelines.txt
doc/build-system-guide.txt
these two should contain all information needed for modifying or creating LTP testcases. If something is not covered there don't hesitate to ask on the LTP mailing list.
Also note that these documents are available online at:
https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines