linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07076
[Bug 1194299] Re: Threading issues in hub management
updateCounts is not thread safe what comes to counting the hubs
correctly.
if(countType != COUNT_UNCOUNTED) {
--counts[countType];
countType = COUNT_UNCOUNTED;
}
When two threads access that function simultaneously, the second thread
may see the type as uncounted because it has been changed by the first
thread. This means that the second thread won't decrease the hub count
as it should.
if(!aRemove) {
if(getMyIdentity().isOp()) {
countType = COUNT_OP;
} else if(getMyIdentity().isRegistered()) {
countType = COUNT_REGISTERED;
} else {
countType = COUNT_NORMAL;
}
++counts[countType];
}
The count is still incremented by both threads. When AirDC started to
call this function simultaneously once per minute, it usually took a day
or so before users started to get extra hubs in their tags.
--
You received this bug notification because you are a member of
Dcplusplus-team, which is subscribed to DC++.
https://bugs.launchpad.net/bugs/1194299
Title:
Threading issues in hub management
Status in DC++:
New
Bug description:
AdcHub::info is called from various different threads (timer, refresh,
hub, GUI) but it's not thread safe. lastInfoMap is unprotected while
it can be modified from different threads simultaneously. This has
been fixed in AirDC++ by syncing the info calls from other threads to
the hub thread.
Client::updateCounts is another function that shouldn't be called from
different threads because the hub counts may go wrong. This started to
cause real problems in AirDC++ when the info calls from TimerManager
were synced to the hub threads, which caused them to get executed
asynchronously all the time.
To manage notifications about this bug go to:
https://bugs.launchpad.net/dcplusplus/+bug/1194299/+subscriptions
References