- **status**: review --> fixed
- **Comment**:
changeset: 5319:bacc4f0b7548
tag: tip
parent: 5317:e12a2d0afdf7
user: Lennart Lund <[email protected]>
date: Mon May 26 13:49:32 2014 +0200
summary: log: Fix possible thread race on timeout in file api [#919]
rev: bacc4f0b75487cd79e4e2e76dabea0b83079f8dd
changeset: 5318:edc1a29443bb
branch: opensaf-4.4.x
parent: 5316:cc06765dba2a
user: Lennart Lund <[email protected]>
date: Mon May 26 13:49:32 2014 +0200
summary: log: Fix possible thread race on timeout in file api [#919]
rev: edc1a29443bb43baf4d24bd61a337fad3862bede
---
** [tickets:#919] log: Race condition between timeout and reply**
**Status:** fixed
**Milestone:** 4.4.1
**Created:** Wed May 21, 2014 08:18 AM UTC by Anders Widell
**Last Updated:** Fri May 23, 2014 02:55 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 [email protected] 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.------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets