Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crash-server] Падаем при расчете средней скорости скачивания. #1305

Closed
pavel-pimenov opened this issue Aug 25, 2015 · 3 comments

Comments

@pavel-pimenov
Copy link
Owner

@pavel-pimenov pavel-pimenov commented Aug 25, 2015

From Pavel.Pimenov@gmail.com on September 09, 2013 21:15:34

https://crash-server.com/Problem.aspx?ClientID=ppa&ProblemID=16402 Стек такой: http://www.flickr.com/photos/96019675@N02/9709638465/ http://www.flickr.com/photos/96019675@N02/9712882422/ В обоих местах побывал Алексей...
прокомментируешь?

Original issue: http://code.google.com/p/flylinkdc/issues/detail?id=1268

@pavel-pimenov pavel-pimenov added the bug label Aug 25, 2015
@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 25, 2015

From Pavel.Pimenov@gmail.com on September 09, 2013 12:22:05

Из замеченного нашел пока лишний обход коллекции downloads

1 Ты делаешь два вызова
q->calcAndUpdateAverageSpeed(); // [+] IRainman opt. // https://crash-server.com/DumpGroup.aspx?ClientID=ppa&DumpGroupID=50335 q->calcAndUpdateDownloadedBytes(); // [+] IRainman fix: https://code.google.com/p/flylinkdc/issues/detail?id=992 Внутри методов выполняется вот такая итерация
for (auto i = downloads.cbegin(); i != downloads.cend(); ++i)
{
const DownloadPtr d = *i;
total += d->getPos(); // [!] IRainman fix done: [6] https://www.box.net/shared/bcc1e978be39a1e0cbf6 }

for (auto i = downloads.cbegin(); i != downloads.cend(); ++i)
{
l_totalSpeed += (*i)->getRunningAverage(); // Bug https://crash-server.com/Problem.aspx?ClientID=ppa&ProblemID=16402 }

Предлагаю это оптимизнуть и оставить один проход.
я сделаю или сам?

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 25, 2015

From Pavel.Pimenov@gmail.com on September 09, 2013 12:27:23

думаю прооблема падения кроится в getRunningFiles(l_um);
он пробегает по queue
void getRunningFiles(QueueItemList& p_get_itemList) const noexcept
{
SharedLock l(csFQ); // [+] IRainman fix.
for (auto i = m_queue.cbegin(); i != m_queue.cend(); ++i)

и наполняет коллекцию p_get_itemList.push_back(q)
потм снимается блокировка с m_queue
и наружу выходит не защищенный массив по которому уже бегаем без лока.
в общем бажное место.

@pavel-pimenov
Copy link
Owner Author

@pavel-pimenov pavel-pimenov commented Aug 25, 2015

From Pavel.Pimenov@gmail.com on September 10, 2013 05:19:24

This issue was closed by revision r15333 .

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.