Tookmund / Swapspace

A fork of Jeroen T. Vermeulen's excellent dynamic swap space manager
GNU General Public License v2.0
128 stars 12 forks source link

Swapspace doesn't remove swapfile #15

Closed oktorok closed 5 years ago

oktorok commented 5 years ago

Hi, i have just installed swapspace in an ubuntu 18.04 server, the reallocation of swapfiles is correct but in the moment i stop my programs the swapfiles arent removed, i tried to execute swapspace -e only for test and give me an error about: "Could not enamble swapfile '2': Device or resource busy" But when i check with "swapon --show" the swapfile '2' is completly empty. Did i miss some configuration or somewthing?

Tookmund commented 5 years ago

Swapspace is designed not to deallocate the swapfile immediately in case more memory is needed soon. Swapfile allocation is a relatively expensive operation. Thus we wait for a bit (600 runs of its main loop) before deallocating a swapfile.

For more details see: https://github.com/Tookmund/Swapspace/blob/master/doc/technicaldetails

Or the place where it’s implemented: https://github.com/Tookmund/Swapspace/blob/master/src/state.c

You can run the program with the verbose flag to see what it’s doing at any given time.

oktorok commented 5 years ago

It has been almost a day and the swapfiles still there, and i can't make swapspace -e or service swapspace restart for remove the swapfiles. I could make service swapspace stop and swapoff -all but i would prefer to be authomatic, any idea?

i could think that maybe there are programs with info in the swapfile (because actually i have 3 swapfiles of 8 gigas and one of them has 300 Megas written) but since i have swapfiles empty why they don't deallocate? is swapspace waiting for deallocate everyfile or something?

Tookmund commented 5 years ago

That definitely shouldn’t be happening What’s the output of swapon --show look like currently?

Can you try stopping the service, running swapoff and removing the file. Then restart with --verbose and recreate the situation.

That way it should log what’s happening and should give some insight into why it’s not working correctly.

Jacob

On May 3, 2019, at 04:09, Jaume notifications@github.com wrote:

It has been almost a day and the swapfiles still there, and i can't make swapspace -e or service swapspace restart for remove the swapfiles. I could make service swapspace stop and swapoff -all but i would prefer to be authomatic, any idea?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

oktorok commented 5 years ago

I have done this:

  1. sudo service stop swapspace
  2. sudo swapspace -v [in another terminal]
  3. program that use a lot of RAM for check swapspace
  4. wait for swapspace allocate something and stop program

this is the output from swapspace:

steady -> overfed overfed -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady Notice: Allocating swapfile '1' Setting up swapspace version 1, size = 8 GiB (8589930496 bytes) no label, UUID=65665f5c-d765-4140-8471-269a4443baff steady -> hungry hungry -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady steady -> overfed overfed -> steady and goes on like that

A thing that i have thought is: i have installed swapspace from apt install, is it possible that the apt version is outdated or something and the correct one is compiling from source?

Tookmund commented 5 years ago

You're a few versions behind, but this appears to be an issue with the state machine, which has not seen any changes since the version you're on.

However, if you can update to current master, I've just pushed a change that should increase verbosity a bit so we can see what's going on here.

If you could update and log swapspace output to a file before repeating the steps you took above that would be much appreciated.

oktorok commented 5 years ago

I have purged swapspace and reinstalled it from source

Now when i execute swapspace it creates automatically a swapfile (is not a bad thing is only that before it didn't do it) and i have notice a faster performance reallocating new swapfiles. Despite that still not deallocating the swapfiles but now if i execute swapspace -e it, deallocates the swapfiles.

Anyway the output of the process is in this file

log.txt

Tookmund commented 5 years ago

Sorry been caught up in other projects. That’s very odd. Going to setup a VM with similar specs to see if I can reproduce the issue.

Jacob

On May 3, 2019, at 19:20, Jaume notifications@github.com wrote:

I have purged swapspace and reinstalled it from source

Now when i execute swapspace it creates automatically a swapfile (is not a bad thing is only that before it didn't do it) and i have notice a faster performance reallocating new swapfiles. Despite that still not deallocating the swapfiles but now if i execute swapspace -e it, deallocates the swapfiles.

Anyway the output of the process is in this file

log.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

oktorok commented 5 years ago

Uff sorry, I forgot totally too 😅

It was working good since I did the purge and compile from source, im not sure how much time does it take, but at the end the swap memory is deallocated correctly.

In the test didn't work maybe because I needed reboot first, maybe because I didn't wait enoguht time I'm not completely sure but know is working

Thank you for everything and sorry, for not say anything before.

Obtener Outlook para Androidhttps://aka.ms/ghei36


From: Jacob Adams notifications@github.com Sent: Monday, May 20, 2019 4:03:13 PM To: Tookmund/Swapspace Cc: Jaume; Author Subject: Re: [Tookmund/Swapspace] Swapspace doesn't remove swapfile (#15)

Sorry been caught up in other projects. That’s very odd. Going to setup a VM with similar specs to see if I can reproduce the issue.

Jacob

On May 3, 2019, at 19:20, Jaume notifications@github.com wrote:

I have purged swapspace and reinstalled it from source

Now when i execute swapspace it creates automatically a swapfile (is not a bad thing is only that before it didn't do it) and i have notice a faster performance reallocating new swapfiles. Despite that still not deallocating the swapfiles but now if i execute swapspace -e it, deallocates the swapfiles.

Anyway the output of the process is in this file

log.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Tookmund/Swapspace/issues/15?email_source=notifications&email_token=AHLBHLRGZXNVVTCKIT5Q5K3PWKVSDA5CNFSM4HKGZ2U2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVY5WJQ#issuecomment-494000934, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AHLBHLRW27P7BRKH2A7GCBTPWKVSDANCNFSM4HKGZ2UQ.

Tookmund commented 5 years ago

Don’t worry about it! Glad it’s now working properly