Ticket #16 (closed defect: wontfix)

Opened 6 years ago

Last modified 6 years ago

Fix "Error freeing dispatch queue"

Reported by: dsmith Owned by: dsmith
Priority: minor Milestone: Version 1.0
Component: libcwiid Version: 0.5.02
Keywords: pthread dispatch queue Cc:

Description

I get an occasional error message (listed above). Due to race condition/multi-threading issue, probably in dispatch cancellation logic.

Change History

Changed 6 years ago by dsmith

  • status changed from new to assigned

Changed 6 years ago by dsmith

  • status changed from assigned to closed
  • resolution set to wontfix

Changed 6 years ago by etaurel@…

  • status changed from closed to reopened
  • resolution wontfix deleted

Hi,

I think there is a way to solve this problem. The error comes from the "queue_free" function of the queue management and more specifically from the "pthread_cond_destroy()" in this function. This call returns the error code EBUSY. I think this system call returns this error due to the thread cancellation while it was waiting in the same condition variable (only a guess) Anyway, by modifying the code in the following way, I do not have error message any more.

while (pthread_cond_destroy(&queue->cond) == EBUSY) {

pthread_cond_broadcast(queue->cond);

} The code passes only once in this loop.

Hoping this help

Emmanuel Taurel

Changed 6 years ago by dsmith

I'll leave the ticket open in case there's another 0.5 release, but the API overhaul in 0.6 gets rid of the queues.

I hadn't noticed that one, but there's another condition in which the dispatch thread can try to lock a mutex that's already been destroyed.

Thanks for the fix.

Changed 6 years ago by dsmith

  • status changed from reopened to closed
  • resolution set to wontfix

To be reopened if there's another 0.5 release (unlikely).

Note: See TracTickets for help on using tickets.