james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danny Angus" <da...@apache.org>
Subject RE: NNTPSpooler bug
Date Sun, 27 Oct 2002 19:20:20 GMT
can we push this back 'til the next cycle? or is this tabled for this release already..

> -----Original Message-----
> From: Noel J. Bergman [mailto:noel@devtech.com]
> Sent: 27 October 2002 18:14
> To: James-Dev Mailing List
> Subject: NNTPSpooler bug
> 
> 
> Would someone please sanity check me on this, please?
> 
> Here is the output from heap checking after 36 hours:
> 
>           percent         live       alloc'ed  stack class
>  rank   self  accum    bytes objs   bytes objs trace name
>     1  3.76%  3.76%   151312 3153 11322240 235880  7960 java.lang.String
> 
> That is the #1 entry by live bytes.  3153 strings totaling ~150K. 
>  Checking
> the stack trace, I see:
> 
> TRACE 7960:
> 	java.io.UnixFileSystem.list(UnixFileSystem.java:Native method)
> 	java.io.File.list(File.java:914)
> 
> org.apache.james.nntpserver.repository.NNTPSpooler$SpoolerRunnable
> .run(NNTPS
> pooler.java:207)
> 	java.lang.Thread.run(Thread.java:536)
> 
> This is kind of interesting, since other than leaving it enabled, I'm not
> using NNTP.  Checking the code ...
> 
>  public void run() {
>      getLogger().debug("in spool thread");
>      try {
>          while ( Thread.currentThread().interrupted() == false ) {
>              String[] list = spoolPath.list();
>              for ( int i = 0 ; i < list.length ; i++ ) {
>                  getLogger().debug("Files to process: "+list.length);
>                  if ( lock.lock(list[i]) ) {
>                      File f = new 
> File(spoolPath,list[i]).getAbsoluteFile();
>                      getLogger().debug("Processing file:
> "+f.getAbsolutePath());
>                      try {
>                          process(f);
>                      } catch(Exception ex) {
>                          getLogger().debug("Exception occured while
> processing file: " +
>                                             f.getAbsolutePath(),ex);
>                      } finally {
>                          lock.unlock(list[i]);
>                      }
>                  }
>              }
>              // this is good for other non idle threads
>              try {
>                  Thread.currentThread().sleep(threadIdleTime);
>              } catch(InterruptedException ex) {
>                  // Ignore and continue
>              }
>          }
>      } finally {
>         Thread.currentThread().interrupted();
>      }
>  }
> 
> Amongst other things, during the entire sleep time, we are 
> keeping a lot of
> strings locked in memory.  Seems to me that at the end of the 
> for() loop, we
> should add:
> 
>  list[i] = null; // release this string entry
> 
> and after the for() loop:
> 
>  list = null; // release the array.
> 
> I have some other questions, but this is the first thing that jumped out.
> 
> 	--- Noel
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message