aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: 1 2 3 [4]

Author Topic: known_files a bit fragile....  (Read 24035 times)

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: known_files a bit fragile....
« Reply #45 on: September 23, 2011, 10:08:44 PM »

I think the intense hard disk usage during hashing in background is playing hell with the slow saving of the known file list in the foreground.
To fix this I propose to move the knownfiles->SafeAddKFile() and the knownfiles->Save() from CamuleApp::OnFinishedHashing() to CHashingTask::Entry(). Both are mutex-protected.
If SafeAddKFile() fails no event is posted.

Also switch from the hashed size trigger to a fixed time (like 5 min) to trigger a Save() . Timer becomes a member of CKnownFileList (remember last save/load).

So we will have
Code: [Select]
void CamuleApp::OnFinishedHashing(CHashingEvent& evt)
{
<unchanged>
if (owner) {
<unchanged>
} else {
sharedfiles->SafeAddKFile(result);
}
}

I can make a patch, but I don't like to commit this at the moment shortly before a release.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: known_files a bit fragile....
« Reply #46 on: September 23, 2011, 10:34:15 PM »

Yeah, definitely not for before a release.

Technically, hashed size IS a timer. If you take X time to hash every MB, you'll take X*Y to hash Y megabytes. The reason it's a hashed size counter is because this way it's consistent across small and big files,  except big files should only save when they finish. Small files will be saved when a bunch is done. This sounds like the optimal way to me, tbh.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: known_files a bit fragile....
« Reply #47 on: September 23, 2011, 11:19:15 PM »

What you describe as optimal would still be the same. Only difference, on a fast system we save now more often than on a slow system. With the timer, it will just check after each hashed file if the last save was more than 5 min ago. If yes it will save. (Timer will be reset on each save, and before starting a rehash.)
The time spent feels like an easier to grasp quantity than the megabytes to me.

Anyway, the important part is saving the known.met in background. It really takes too long for a foreground activity with such large shares.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

stoatwblr

  • Sr. Member
  • ****
  • Karma: 12
  • Offline Offline
  • Posts: 318
Re: known_files a bit fragile....
« Reply #48 on: September 24, 2011, 05:34:41 PM »

This still leaves a window of opportunity for the file to be trashed by a SIGKILL or system crash while the old version is gone and new version isn't there. :(


Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: known_files a bit fragile....
« Reply #49 on: October 02, 2011, 01:23:15 PM »

I've changed the write mode in 10620. It now writes to "known.met.new" and renames it after closing.
Though I still don't believe this will solve your actual problem. Still it's good practice.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: known_files a bit fragile....
« Reply #50 on: October 04, 2011, 09:30:35 PM »

Better yet, use 10621.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

x_x_kamikaze_x_x

  • Jr. Member
  • **
  • Karma: 18
  • Offline Offline
  • Posts: 83
Re: known_files a bit fragile....
« Reply #51 on: October 04, 2011, 09:33:50 PM »

Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: known_files a bit fragile....
« Reply #52 on: October 04, 2011, 10:28:51 PM »

http://code.google.com/p/amule/source/checkout

(and that change is probably useless for you unless you have similar problems as stoatwblr)
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

x_x_kamikaze_x_x

  • Jr. Member
  • **
  • Karma: 18
  • Offline Offline
  • Posts: 83
Re: known_files a bit fragile....
« Reply #53 on: October 05, 2011, 08:19:29 PM »

http://code.google.com/p/amule/source/checkout
(and that change is probably useless for you unless you have similar problems as stoatwblr)

Thanks for the info!  :)
Don't worry, I know that but I always want to test the last version in order to
"check" all the new features!  ;D


Hey, this change is very useful.
Please also consider applying write_safe to other critical or big files  (nodes.dat, key_index.dat for example).
Not everybody is running amule on  reliable, fast  systems. Dirty shutdowns, or OOM crashes, can happen .

I think the same!
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: known_files a bit fragile....
« Reply #54 on: October 06, 2011, 08:36:10 PM »

Please also consider applying write_safe to other critical or big files  (nodes.dat, key_index.dat for example).
Anybody else agree/disagree ?
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: known_files a bit fragile....
« Reply #55 on: October 07, 2011, 08:30:35 AM »

nodes.dat: yes
*_index.dat: no
Logged
concordia cum veritate

stoatwblr

  • Sr. Member
  • ****
  • Karma: 12
  • Offline Offline
  • Posts: 318
Re: known_files a bit fragile....
« Reply #56 on: October 10, 2011, 12:19:45 AM »

Better yet, use 10621.

Works perfectly. :)

(I ran through a few crashes to verify all ok)

Thanks
Logged
Pages: 1 2 3 [4]