public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Kang Kai <Kai.Kang@windriver.com>
Cc: ltp-list@lists.sourceforge.net, Zhenfeng.Zhao@windriver.com
Subject: Re: [LTP] [PATCH] pthread_detach/4-3: workaround for segment fault
Date: Tue, 21 Aug 2012 11:45:25 +0200	[thread overview]
Message-ID: <503358B5.8070106@redhat.com> (raw)
In-Reply-To: <503353BA.6040309@windriver.com>

On 08/21/2012 11:24 AM, Kang Kai wrote:
> On 2012年08月21日 09:35, Wanlong Gao wrote:
>> On 08/21/2012 09:31 AM, Kang Kai wrote:
>>> On 2012年08月20日 10:21, Kang Kai wrote:
>>>> On 2012年08月20日 10:01, Wanlong Gao wrote:
>>>>> On 08/20/2012 09:39 AM, Kang Kai wrote:
>>>>>> On 2012年08月19日 06:58, Wanlong Gao wrote:
>>>>>>> On 08/14/2012 05:00 PM, Kang Kai wrote:
>>>>>>>> This case fails randomly with "Segmentation fault". Reset VERBOSE to 6
>>>>>>>> can avoid this problem.
>>>>>>> Can you explain that why "reset VERBOSE" can avoid this "Seg Fault" problem?
>>>>>> It is a multi-thread issue. You can run it for less than 10 times, and it will fail with "Segmentation fault".
>>>>> I didn't see this on my side.
>>> Hi Wanlong,
>>>
>>>> It fails both on mips and x86_64.
>>>> On the x86_64,
>>>> cpu:  Intel I7
>>>> OS:   Ubuntu 11.10
>>>> libc:  eglibc 2.13
>>>> kernel: 3.0.0-12-generic
>>>>
>>>> How about try this script on a x86_64 machine:
>>>> for i in $(seq 100); do echo $i;  ./4-3.run-test ; ret=$?; if [ $ret -ne
>>>> 0 ]; then echo  $? ; break; fi;  done
>>> Do you meet the "Segmentation Fault" yet?
> 
> Hi Wanlong,
>> Not yet.
> I test it on x86_64 with Redhat 5.3, it doesn't fail.

I tried to reproduce it on x86_64 RHEL6/7 (real hw+kvm) and ubuntu-12.04-server (kvm),
but without any luck.

I spotted one possible issue:

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c b/testcases/open_posix_testsuite/conforman
index 5c15e93..7b738e7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
@@ -129,9 +129,13 @@ static void *threaded(void *arg)
                UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2"
                           " in worker thread");
 
-       ret = pthread_detach(pthread_self());
-       if (ret == EINTR)
-               FAILED("pthread_detach() returned EINTR");
+       /* Attempting to detach an already detached thread results
+        * in unspecified behavior */
+       if (scenarii[sc].detached != 1) {
+               ret = pthread_detach(pthread_self());
+               if (ret == EINTR)
+                       FAILED("pthread_detach() returned EINTR");
+       }
 
        /* Signal we're done */
        do {

Regards,
Jan

> I try to compare them to find why it fails with Ubuntu 11.10.
> 
> Thanks,
> Kai
> 
>>
>> Thanks,
>> Wanlong Gao
>>
>>> Regards,
>>> Kai
>>>
>>>>>> It is hard to debug and I didn't find the root cause, but open the VERBOSE will avoid this situation. So it is a workaround.
>>>>> I'd like to send a patch to fix this typo first.
>>>> Fine.
>>>>
>>>> Regards,
>>>> Kai
>>>>
>>>>> Thanks,
>>>>> Wanlong Gao
>>>>>
>>>>>> Regards,
>>>>>> Kai
>>>>>>
>>>>>>>> Fix typo at same time.
>>>>>>> The typo fix is OK.
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Wanlong Gao
>>>>>>>
>>>>>>>> Signed-off-by: Kang Kai<kai.kang@windriver.com>
>>>>>>>> ---
>>>>>>>>      .../conformance/interfaces/pthread_detach/4-3.c    |    4 ++--
>>>>>>>>      1 files changed, 2 insertions(+), 2 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
>>>>>>>> index 5c15e93..23738dc 100644
>>>>>>>> --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
>>>>>>>> +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-3.c
>>>>>>>> @@ -49,7 +49,7 @@
>>>>>>>>      #include "../testfrmw/testfrmw.c"
>>>>>>>>
>>>>>>>>      #ifndef VERBOSE
>>>>>>>> -#define VERBOSE 1
>>>>>>>> +#define VERBOSE 6
>>>>>>>>      #endif
>>>>>>>>
>>>>>>>>      #define WITH_SYNCHRO
>>>>>>>> @@ -281,7 +281,7 @@ int main(int argc, char *argv[])
>>>>>>>>
>>>>>>>>          do {
>>>>>>>>              do_it2 = 0;
>>>>>>>> -    } while (do_it2 = 0);
>>>>>>>> +    } while (do_it2);
>>>>>>>>
>>>>>>>>          ret = pthread_join(th_sig1, NULL);
>>>>>>>>          if (ret)
>>>>>>>>
>>>> ------------------------------------------------------------------------------
>>>> Live Security Virtual Conference
>>>> Exclusive live event will cover all the ways today's security and
>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>> will include endpoint security, mobile security and the latest in malware
>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>> _______________________________________________
>>>> Ltp-list mailing list
>>>> Ltp-list@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>>>
>>
> 
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2012-08-21  9:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14  9:00 [LTP] [PATCH] pthread_detach/4-3: workaround for segment fault Kang Kai
2012-08-18 22:58 ` Wanlong Gao
2012-08-20  1:39   ` Kang Kai
2012-08-20  2:01     ` Wanlong Gao
2012-08-20  2:21       ` Kang Kai
2012-08-21  1:31         ` Kang Kai
2012-08-21  1:35           ` Wanlong Gao
2012-08-21  9:24             ` Kang Kai
2012-08-21  9:24               ` Wanlong Gao
2012-08-21  9:45               ` Jan Stancek [this message]
2012-08-21  9:59                 ` Kang Kai
  -- strict thread matches above, loose matches on Subject: below --
2012-08-21 10:35 Jan Stancek
2012-08-22  2:29 ` Kang Kai
2012-08-22  7:06   ` Jan Stancek
2012-08-22  8:28     ` Kang Kai
2012-08-22  8:58       ` Jan Stancek
2012-08-22 14:20         ` Jan Stancek
2012-08-23  6:21           ` Kang Kai
2012-08-23  7:09             ` Jan Stancek
2012-08-23 11:07               ` Jan Stancek
2012-08-24  2:46                 ` Kang Kai
2012-08-28  8:37                   ` Jan Stancek
2012-08-29  8:57                     ` Kang Kai
2012-08-29  9:21                       ` Jan Stancek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=503358B5.8070106@redhat.com \
    --to=jstancek@redhat.com \
    --cc=Kai.Kang@windriver.com \
    --cc=Zhenfeng.Zhao@windriver.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox