Modify

Ticket #7657 (closed Bugs: fixed)

Opened 18 months ago

Last modified 17 months ago

Serious performance and memory consumption hit if condition_variable methods condition notify_one or notify_all is used repeatedly

Reported by: Petr Dannhofer <petr.dannhofer@…> Owned by: viboes
Milestone: Boost 1.53.0 Component: thread
Version: Boost 1.52.0 Severity: Showstopper
Keywords: Cc:

Description

platform: Win32, MSVS11

condition_variable::generations member contains list of basic_cv_list_entry instances. As notify_one or notify_all is called, each instance member release is called, setting basic_cv_list_entry::notified member to true. There is no code which set basic_cv_list_entry::notified to false again, so the entry stays notified forever.

Items from condition_variable::generations are deleted only when there are no waiters for the entry. The waiters are removed in entry_manager::~entry_manager. New addition to 1.52 version is that waiter is removed only if the entry is not notified (line 198 thread/win32/condition_variable.hpp). As result, new entries are added for every get_wait_entry() call, which means for every wait call (as waiter can be added only to unnotified entry, which is the same story all over again), condition_variable::generations vector grows infinitely, consuming memory and processor time for useless searches for entries that could be removed.

Attachments

Change History

comment:1 Changed 18 months ago by Petr Dannhofer <petr.dannhofer@…>

proposed patch: remove if(! entry->is_notified()) condition from ~entry_manager()

comment:2 Changed 18 months ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned

comment:3 Changed 18 months ago by viboes

Hi, I added this patch to solve #7461, but unfortunately it introduces a regression. I will rollback it and then take the time to analyze what is happening.

Thanks for the report.

Last edited 18 months ago by viboes (previous) (diff)

comment:4 Changed 18 months ago by viboes

Committed in trunk revision [81254].

Last edited 18 months ago by viboes (previous) (diff)

comment:5 Changed 18 months ago by viboes

  • Milestone changed from To Be Determined to Boost 1.53.0

comment:6 Changed 17 months ago by viboes

  • Summary changed from Serious performance and memory consuption hit if condition_variable methods condition notify_one or notify_all is used repeatedly to Serious performance and memory consumption hit if condition_variable methods condition notify_one or notify_all is used repeatedly

comment:7 Changed 17 months ago by viboes

  • Status changed from assigned to closed
  • Resolution set to fixed

Committed revision [81667].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.