rsync and memory leak on linux 2.2?
We have two machines running Linux 2.2 with ReiserFS v3.5.32 and we're seeing a memory leak which we feel is related to reiser and some interaction with rsync.
The configuration is such that system A maintains a set of log files and these files are mirrored via rsync on system B for redundancy.
What happens is that we put both systems under a fixed work load and after many hours system B will start consuming lots of swap and suffer degraded performance. Through some kernel debugging we discovered that the 4K kmalloc slab is slowly growing to the point where there is enough memory pressure to start swapping. We observe that one of the heaviest users of the 4K slab is reiserfs_kmalloc(), and in particular, the calls issued from get_mem_for_virtual_node() and reiserfs_file_write(). As an experiment we ran the same work load, but this time disabled the rsync'ing of the log files and we no longer see the growth in the 4k slab.
This leads us to believe that we have a memory leak somewhere in the reiserfs and was wondering if anyone else has seen this, and if so, if a patch exists.
One question I have is that get_mem_for_virtual_node() will first attempt to allocate memory atomically, and if this fails, will re-try non atomically. In this case we return SCHEDULE_OCCURRED which results in fix_nodes() will also return to its caller. Is it possible for buffer allocated by get_mem_for_virtual_node() to be lost in this case? I did not see any path out of reiserfs_file_write() in which we could return w/o freeing the buffer. Perhaps this problem is triggered via memory pressure?
I scanned the 2.2.20 reiser patch and did not see any fix that was apparent to me. Any suggestions / recommendations would be appreciated.
Thanks,
Pat
p.s. Please CC me on any reply, I am not subscribed to this list.
Signature · 2 lines
Patrick O'Rourke [email protected]
Hello!
Quoted 10 lines · Patrick O'Rourke
What happens is that we put both systems under a fixed work load and after many hours system B will start consuming lots of swap and suffer degraded performance. Through some kernel debugging we discovered that the 4K kmalloc slab is slowly growing to the point where there is enough memory pressure to start swapping. We observe that one of the heaviest users of the 4K slab is
reiserfs_kmalloc(), and in particular, the calls issued fromget_mem_for_virtual_node()andreiserfs_file_write(). As an experiment we ran the same work load, but this time disabled the rsync'ing of the log files and we no longer see the growth in the 4k slab.
This leads us to believe that we have a memory leak somewhere in the reiserfs
Quoted 8 lines
and was wondering if anyone else has seen this, and if so, if a patch exists. One question I have is that
get_mem_for_virtual_node()will first attempt to allocate memory atomically, and if this fails, will re-try non atomically. In this case we returnSCHEDULE_OCCURREDwhich results infix_nodes()will also return to its caller. Is it possible for buffer allocated byget_mem_for_virtual_node()to be lost in this case? I did not see any path out ofreiserfs_file_write()in which we could return w/o freeing the buffer. Perhaps this problem is triggered via memory pressure?
Thanks for the report. I will investigate it tomorrow, when it is day again in Russia.
Meanwile there is easy way to find if there is some memory leaked through reiserfs_kmalloc. If you enable CONFIG_REISERFS_CHECK kernel option, then there is code in reiserfs_kmalloc, that cheks if we alloc, but not free the memory.
It will print a warning once in a while.
But please note that CONFIG_REISERFS_CHECK will impose some (substantial?) slowdown to reiserfs operations, so you might just unconditionally enable the check for memleak in there if you cannot afford the slowdown.
Bye,
Oleg
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Patrick" == Patrick O'Rourke <[email protected]> writes:
Patrick> We have two machines running Linux 2.2 with ReiserFS Patrick> v3.5.32 and we're seeing a memory leak which we feel is Patrick> related to reiser and some interaction with rsync.
Well, there is a 3.5.34 which has, obviously, a number of bug fixes. You could try that. I've been running 2.2.20 with this version for a good number of months on several servers with no problems.
Sincerely,
Adrian Phillips
Signature · 3 lines
Your mouse has moved. Windows NT must be restarted for the change to take effect. Reboot now? [OK]
Hello!
Quoted 4 lines · Adrian Phillips
Patrick> We have two machines running Linux 2.2 with ReiserFS Patrick> v3.5.32 and we're seeing a memory leak which we feel is Patrick> related to reiser and some interaction with rsync.
Well, there is a 3.5.34 which has, obviously, a number of bug
There are 3.5.35 and 3.5.36-beta that are even better ;)
Bye,
Oleg
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Oleg" == Oleg Drokin <[email protected]> writes:
Oleg> There are 3.5.35 and 3.5.36-beta that are even better ;)
I'd forgotten 35, even though I had saved the announcement. To busy testing 2.4 last year when it came out. That and the fact that all the servers were running rock solid. Thanks to the reiserfs team :-)
Sincerely,
Adrian Phillips
Signature · 3 lines
Your mouse has moved. Windows NT must be restarted for the change to take effect. Reboot now? [OK]
Quoted 5 lines · Oleg Drokin
Quoted 4 lines · Adrian Phillips
Patrick> We have two machines running Linux 2.2 with ReiserFS Patrick> v3.5.32 and we're seeing a memory leak which we feel is Patrick> related to reiser and some interaction with rsync.
Well, there is a 3.5.34 which has, obviously, a number of bug
I just thought I would follow up with a note that the bug turned out NOT to be in the reiser code. The rsync operation I described turned out to be a red herring.
Thanks for the suggestions,
Pat
Signature · 2 lines
Patrick O'Rourke [email protected]
Quoted 14 lines · Patrick O'Rourke
Quoted 9 lines · Oleg Drokin
Quoted 6 lines · Adrian Phillips
Patrick> We have two machines running Linux 2.2 with ReiserFS Patrick> v3.5.32 and we're seeing a memory leak which we feel is Patrick> related to reiser and some interaction with rsync.
Well, there is a 3.5.34 which has, obviously, a number of bug
Quoted 10 lines
I just thought I would follow up with a note that the bug turned out NOT to be in the reiser code. The rsync operation I described turned out to be a red herring.
Thanks for the suggestions,
Pat
Thanks Patrick. This leaves us with one unsolved reiserfs V3 bug that I know of (unlink related one, vs is working on it, and he is not completely sure it is reiserfs not vfs....). Oleg, am I right in thinking that the samba+reiserfs bug looks like a samba bug?
Signature · 1 line
Hans
Hello!
Quoted 2 lines · Hans Reiser
Thanks Patrick. This leaves us with one unsolved reiserfs V3 bug that I know of (unlink related one, vs is working on it, and he is not
Vladimir tracked that down yesterday.
At least we think so. (and even if the fix we discussed yesterday won't help, that'd mean we have another bug in addition to what Vladimir found. And this is indeed a race between two iget(). I am not sure if VFS is flawed, but I think at least partially it is. Because in 2.5 that piece of code redesigned right way.)
Quoted 2 lines
completely sure it is reiserfs not vfs....). Oleg, am I right in thinking that the samba+reiserfs bug looks like a samba bug?
That turned out to be fs corruption of unknown source. Hardware is the main suspect for now.
Bye,
Oleg
Quoted 3 lines · Adrian Phillips
Well, there is a 3.5.34 which has, obviously, a number of bug fixes. You could try that. I've been running 2.2.20 with this version for a good number of months on several servers with no problems.
That's a thought. We've been running w/ 3.5.32 (+ a variety of fixes) for over a year and this is the only issue we have thus far and it only occurs in an isolated scenario (i.e. rsync).
Thanks for the suggestion.
Pat
Signature · 2 lines
Patrick O'Rourke [email protected]