How do I reject getting my own comments on e-mail?
Re: Memory Leak??
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• RYXI
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

RYXI > Solaris > Re: Memory Leak?? 7 January 2008 16:29:04

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

Re: Memory Leak??

John L 7 January 2008 16:29:04
 
"Tim Bradshaw" <tfb+google@tfeb.or­g> wrote in message news:38e1494d-81be-­4e88-bb2a-5201875522­a6@j20g2000hsi.googl­egroups.com...
On Dec 21, 7:15 pm, Chimpanzee <govi...@gmail.com>­ wrote:
James,
If this a design,is there a workaround to it.There is a log rotation
process happening on /home, that keeps the last 14 days logs(which are
roughly about 25M size) and removes the remaining
Typically things which rotate logs need to cooperate with the
application which is writing the logs: either it needs to notice that
the logs have been rotated and close & reopen the logs, or there needs
to be some way of the log rotator notifying the application. This is
often done by sending it a signal, and log rotators can generally do
this & other things. See logadm(1M).
If you don't do this you run two risks: one is this mysterious space
usage from deleted files which are still open, but a more serious risk
is that the logs getting written to these deleted files are
inaccessible, which means you may lose critical information.

As a workaround, the OP can try copy-and-truncate log rotation
(cp logfile logfile.whatever ; > logfile) but should be aware there is
an obvious risk of missing log entries between the copy and
the truncation operations. Iirc logadm can do this too.

However, there may be something else going on. The OP states there
is already a log rotation process. If this was designed in association
with the programmers, then either there is a bug that means it does
not work properly, or there is some other process holding the file open
(monitoring perhaps, or one of the programmers tail-ing the log).

--
John.



Add comment
James Carlson 3 January 2008 21:35:59 permanent link ]
 Chimpanzee <govindo@gmail.com>­ writes:
If this a design,is there a workaround to it.There is a log rotation
process happening on /home, that keeps the last 14 days logs(which are
roughly about 25M size) and removes the remaining

The "work-around" is proper design in the application. If log files
are being written and rotated, it's pretty common for the application
to have some sort of close-and-reopen mechanism. It's usually hooked
to SIGHUP, but I've seen other types. If it has no such mechanism,
then you'll probably need to talk to the application author.

The way such a mechanism is used is that the log file is moved aside,
a new one is created (if necessary; syslogd needs this), and then
"pkill -HUP" is run on the application. At this point, the rotated
log file is closed and can be compressed, archived, deleted, or
whatever you need to do.

Is restarting the application only option?

That's a crude but effective option ... you'll need to read the
application documentation or get in touch with the application author
to figure out better answers.

--
James Carlson, Solaris Networking <james.d.carlson@su­n.com>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
Add comment
Chimpanzee 4 January 2008 23:33:42 permanent link ]
 Thanks for your responses,however I wasn`t sure if it was caused by
log rotation.Therefore I did some search on internet and found a
pattern similar to my problem.

a. Finding an Unlinked Open File
===================­==============

A pesky variant of a file that is filling a file system is an
unlinked file to which some process is still writing. When a
process opens a file and then unlinks it, the file's resources
remain in use by the process, but the file's directory entries
are removed. Hence, even when you know the directory where the
file once resided, you can't detect it with ls.

This can be an administrative problem when the unlinked file is
large, and the process that holds it open continues to write to
it. Only when the process closes the file will its resources,
particularly disk space, be released.

Lsof can help you find unlinked files on local disks. It has an
option, +L, that will list the link counts of open files. That
helps because an unlinked file on a local disk has a zero link
count. Note: this is NOT true for NFS files, accessed from a
remote server.

You could use the option to list all files and look for a zero
link count in the NLINK column -- e.g.,

$lsof +L
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
...
less 25366 abe txt VREG 6,0 40960 1 76319 /usr/...
...
less 25366 abe 3r VREG 6,0 17360 0 98768 / (/dev/
sd0a)

Better yet, you can specify an upper bound to the +L option, and
lsof will select only files that have a link count less than the
upper bound. For example:

$ lsof +L1
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
less 25366 abe 3r VREG 6,0 17360 0 98768 / (/dev/
sd0a)

You can use lsof's -a (AND) option to narrow the link count search
to a particular file system. For example, to look for zero link
counts on the /home file system, use:

$ lsof -a +L1 /home

I ran the command and had large number of files being reported

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME
yyyyySe 539 root txt VREG 85,5 75496 0 525 /home (/dev/
md/dsk/d5)
xxxyyyzzz 20397 u01 3w VREG 85,5 13303630 0 1957 /home (/
dev/md/dsk/d5)
xxxyyyzzz 20397 u01 159w VREG 85,5 29611647 0 3995 /home (/
dev/md/dsk/d5)
xxxyyyzzz 20397 u01 160w VREG 85,5 29691202 0 3763 /home (/
dev/md/dsk/d5)
xxxyyyzzz 20763 u01 3w VREG 85,5 12612023 0 2932 /home (/
dev/md/dsk/d5)
xxxyyyzzz 20763 u01 159w VREG 85,5 29339459 0 4899 /home (/
dev/md/dsk/d5)
xxxyyyzzz 20763 u01 160w VREG 85,5 29495375 0 4891 /home (/
dev/md/dsk/d5)
tclsh8.3 20880 u01 1w VREG 85,5 389263256 0 936 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21143 u01 3w VREG 85,5 12447186 0 3163 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21143 u01 159w VREG 85,5 29181050 0 4888 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21143 u01 160w VREG 85,5 29051583 0 4903 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21515 u01 3w VREG 85,5 12473469 0 3258 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21515 u01 159w VREG 85,5 29210273 0 4897 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21515 u01 160w VREG 85,5 29351688 0 4893 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21866 u01 3w VREG 85,5 8601073 0 3353 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21866 u01 111w VREG 85,5 20133585 0 4895 /home (/
dev/md/dsk/d5)
xxxyyyzzz 21866 u01 112w VREG 85,5 20226743 0 4901 /home (/
dev/md/dsk/d5)
ksh 24406 u01 63u VREG 85,5 487282 0 3073 /home (/
dev/md/dsk/d5)


Any thoughts?

Cheers
CG
Add comment
James Carlson 7 January 2008 16:29:04 permanent link ]
 Chimpanzee <govindo@gmail.com>­ writes:
Thanks for your responses,however I wasn`t sure if it was caused by
log rotation.Therefore I did some search on internet and found a
pattern similar to my problem.
a. Finding an Unlinked Open File
[...]
Any thoughts?

That's exactly the sort of symptoms you described before, and the
scenario that several of us have suggested as the probable cause of
the problem you've seen.

--
James Carlson, Solaris Networking <james.d.carlson@su­n.com>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


RYXI > Solaris > Re: Memory Leak?? 7 January 2008 16:29:04

see also:
DAAPD make fails on install
How to obtain patch level from Linux…
change default icons on desktop?
пройди тесты:
see also:
Multiboot - can only load one operating…
Webcam Video Capture

  Copyright © 2001—2008 RYXI
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.ryxi.com.
Сообщения об ошибках оставляем в сообществе bugs.ryxi.com.
Предложения и комментарии пишем в сообществе suggest.ryxi.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .