Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 33004 invoked from network); 8 May 2008 17:03:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 May 2008 17:03:21 -0000 Received: (qmail 18470 invoked by uid 500); 8 May 2008 17:03:23 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 18450 invoked by uid 500); 8 May 2008 17:03:23 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 18439 invoked by uid 99); 8 May 2008 17:03:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 May 2008 10:03:23 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 May 2008 17:02:46 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 23066234C10A for ; Thu, 8 May 2008 10:03:01 -0700 (PDT) Message-ID: <424599780.1210266181142.JavaMail.jira@brutus> Date: Thu, 8 May 2008 10:03:01 -0700 (PDT) From: "Travis Vitek (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Commented: (STDCXX-536) allow thread safety tests to time out without failing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-536?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595332#action_12595332 ] Travis Vitek commented on STDCXX-536: ------------------------------------- Okay, I submitted an initial patch to remove the rw_ prefix from test local option variables. See [r654561|http://svn.apache.org/viewvc?rev=654561&view=rev]. I'll submit a new patch when we make some decisions about what to do with the issues you just brought up. As for those issues... 1. From memory the only issue with using alarm() in a threaded program is that you have no control over which thread will get the signal. This can be a problem is some threads in your program ignore signals, and the signal is delivered to one of those threads. Having the main thread sleep for the timeout period is not really a good solution. If the timeout is 60 seconds, but the threads complete in 5, the main thread would waste 55 seconds waiting for the timeout to expire. It also has the problem that it won't work with single threaded builds. I have considered several possible implementations, and I don't see many options. One option would be to pass some context data to the thread and let the thread decide if it is time to exit on its own. The context could include the 'drop dead time' for the thread and then the thread could check the current time against that. Unfortunately that moves more logic into the thread_func and into the function used to poll timeouts Another option would be to build a timer queue. This would require that the test library always be built with threads so that we could spawn a thread to service the timers. 2. I have no problem with that provided we can decide how we want to solve #1 above. 3. I considered doing something like this, but it seemed like unnecessary optimization. As for the type of the timeout flag, it should probably be changed to {{volatile sig_atomic_t}} if we are going to use {{alarm()}}. > allow thread safety tests to time out without failing > ----------------------------------------------------- > > Key: STDCXX-536 > URL: https://issues.apache.org/jira/browse/STDCXX-536 > Project: C++ Standard Library > Issue Type: Improvement > Components: Tests > Affects Versions: 4.2.0 > Reporter: Martin Sebor > Assignee: Travis Vitek > Fix For: 4.2.2 > > Attachments: stdcxx-536.patch > > Original Estimate: 3h > Time Spent: 4h > Remaining Estimate: 0h > > The newly added thread safety tests (and possibly some of the existing ones) tend to run for a long time, consuming a lot of CPU cycles, and sometimes even failing due to a timeout (currently 300 seconds in nightly builds). It would be useful to provide a mechanism such as a command line option whereby the tests' runtime could be limited without necessarily causing them to fail when the amount of time is exceeded. One way to do it would be for each test to set an alarm in response to this command line option and in handler for the alarm set a flag that each thread would check at each iteration of its loop to see if it should break. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.