https://sourceforge.net/p/opensaf/mailman/message/32373566/
https://sourceforge.net/p/opensaf/mailman/message/32373567/


---

** [tickets:#919] log: Race condition between timeout and reply**

**Status:** review
**Milestone:** 4.4.1
**Created:** Wed May 21, 2014 08:18 AM UTC by Anders Widell
**Last Updated:** Fri May 23, 2014 02:54 PM UTC
**Owner:** elunlen

There is a race condition in lgs_file.c, where a reply can be sent by the file 
handling thread at the same time as the main thread times out waiting for the 
reply:

    while (lgs_com_data.answer_f == false) {
        rc = pthread_cond_timedwait(
                &answer_cv, &lgs_ftcom_mutex, &timeout_time); /* -> UNLOCK -> 
LOCK */
        if (rc == ETIMEDOUT) {
            TRACE("Timed out before answer");
            api_rc = LGSF_TIMEOUT;
            lgs_com_data.timeout_f = true; /* Inform thread about timeout */
            goto api_exit;
        } else if (rc != 0) {
            TRACE("pthread wait Failed - %s",strerror(rc));
            osaf_abort(rc);
        }
    }


When pthread_cond_timedwait() returns due a time-out in the code above, there 
is no check if the condition variable lgs_com_data.answer_f is true. The code 
should be changed to check (rc == ETIMEDOUT && lgs_com_data.answer_f == false), 
so that time-out handling is only performed when there is no reply.


---

Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to