You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Jinsuo Zhang <ji...@cise.ufl.edu> on 2002/03/25 11:06:59 UTC

process spawning

hello,
    Do I need to close database just like closing of collection?
It seems it will generate hundreds of java process if only closing
collection after a long time accumulation of this routine work.
In linux, it behave this way, but in windows, no this strange
behavior.
   Thanks for help.

-- 
Jinsuo Zhang

CISE department
Univ of Florida


Re: process spawning

Posted by Anders Conrad <ac...@dsl.dk>.
Hi MIke.

It is great if you can find out about this.
I wrote about similar symptoms using Xindice/Tomcat on March 15. to this
list (title "Memory problems under linux"). There has been other reports as
well.

Anders
----- Original Message -----
From: "Michael Gratton" <mi...@vee.net>
To: <xi...@xml.apache.org>
Sent: Monday, March 25, 2002 11:54 PM
Subject: Re: process spawning


>
>
> Jinsuo Zhang wrote:
> >    Creating only one copy of collection can avoid the problem.
> > but the developers of xindice API may need have a look into it to
> > see if this is a bug or not.
> >
>
> This definitely is a problem with Xindice. I'm getting the same effect
> with a Tomcat based webapp under FreeBSD. I'll put some effort into
> trying to track this down once I've finished some preliminary
> investigations I'm doing into reducing the ill effects of this bug, but
> if anyone has any other testcases or data points, please let me know.
>
> --
> Mike Gratton <mi...@vee.net>, <http://web.vee.net/>
> Leader in leachate production and transmission since 1976.
>


Re: process spawning

Posted by Michael Gratton <mi...@vee.net>.

Jinsuo Zhang wrote:
>    Creating only one copy of collection can avoid the problem.
> but the developers of xindice API may need have a look into it to
> see if this is a bug or not.
> 

This definitely is a problem with Xindice. I'm getting the same effect 
with a Tomcat based webapp under FreeBSD. I'll put some effort into 
trying to track this down once I've finished some preliminary 
investigations I'm doing into reducing the ill effects of this bug, but 
if anyone has any other testcases or data points, please let me know.

-- 
Mike Gratton <mi...@vee.net>, <http://web.vee.net/>
Leader in leachate production and transmission since 1976.


Re: process spawning

Posted by Jinsuo Zhang <ji...@cise.ufl.edu>.
Hi Mark:
   thanks.
   Creating only one copy of collection can avoid the problem.
but the developers of xindice API may need have a look into it to
see if this is a bug or not.

-- 
Jinsuo Zhang

CISE department
Univ of Florida

On Mon, 25 Mar 2002, Mark J. Stang wrote:

> I don't see any obvious errors, but I would create a "singleton"
> collection
> manager.   Do the database registration once, also create your collection
> once
> and store it in a map.   Whenever you need it, get it from the
> singleton.   The only
> issue is when you close it...   You can close it everytime or leave it
> open and close
> it at the end of the program.   I leave mine open until I close the
> program.
> 
> Mark
> 
> Jinsuo Zhang wrote:
> 
> > On Mon, 25 Mar 2002, Mark J. Stang wrote:
> >
> > > This is either a bug or something you are doing wrong.   Can you
> > send
> > > a sample of the code so the list can try and determine which it is?
> > >
> > > Mark
> > >
> >
> > Hi, below is my code segment:
> >     Thanks for help.
> >
> > public class DBXMLProxy
> > {
> >
> >    public static String add_doc(String docname, String URI) throws
> > Exception {
> >       Collection col = null;
> >       String retval;
> >       try {
> >          String driver =
> > "org.apache.xindice.client.xmldb.DatabaseImpl";
> >          Class c = Class.forName(driver);
> >
> >          Database database = (Database) c.newInstance();
> >          DatabaseManager.registerDatabase(database);
> >          col =
> >
> > DatabaseManager.getCollection("xmldb:xindice:///db/mobiledata");
> >
> >          String data = readFileFromDisk(docname);
> >
> >          XMLResource document = (XMLResource) col.createResource(URI,
> >             "XMLResource");
> >          document.setContent(data);
> >          col.storeResource(document);
> >          retval = "1";
> >       }
> >       catch (XMLDBException e) {
> >          System.out.println("XML:DB Exception occured " + e.errorCode
> > + " " +
> >             e.getMessage());
> >          retval = null;
> >       }
> >       finally {
> >          if (col != null) {
> >             col.close();
> >          }
> >       }
> >       return retval;
> >    }
> >   ...
> >   similar routines to do xml related work
> >   ....
> >
> >    public static void main(String[] args) throws Exception
> >     {
> >       ...
> >       loop
> >       {
> >         get request from other programs, and call requested routine.
> >       }
> >      ...
> >    }
> > }
> >
> > --
> > Jinsuo Zhang
> >
> > CISE department
> > Univ of Florida
> 
> 


Re: process spawning

Posted by "Mark J. Stang" <ma...@earthlink.net>.
I don't see any obvious errors, but I would create a "singleton"
collection
manager.   Do the database registration once, also create your collection
once
and store it in a map.   Whenever you need it, get it from the
singleton.   The only
issue is when you close it...   You can close it everytime or leave it
open and close
it at the end of the program.   I leave mine open until I close the
program.

Mark

Jinsuo Zhang wrote:

> On Mon, 25 Mar 2002, Mark J. Stang wrote:
>
> > This is either a bug or something you are doing wrong.   Can you
> send
> > a sample of the code so the list can try and determine which it is?
> >
> > Mark
> >
>
> Hi, below is my code segment:
>     Thanks for help.
>
> public class DBXMLProxy
> {
>
>    public static String add_doc(String docname, String URI) throws
> Exception {
>       Collection col = null;
>       String retval;
>       try {
>          String driver =
> "org.apache.xindice.client.xmldb.DatabaseImpl";
>          Class c = Class.forName(driver);
>
>          Database database = (Database) c.newInstance();
>          DatabaseManager.registerDatabase(database);
>          col =
>
> DatabaseManager.getCollection("xmldb:xindice:///db/mobiledata");
>
>          String data = readFileFromDisk(docname);
>
>          XMLResource document = (XMLResource) col.createResource(URI,
>             "XMLResource");
>          document.setContent(data);
>          col.storeResource(document);
>          retval = "1";
>       }
>       catch (XMLDBException e) {
>          System.out.println("XML:DB Exception occured " + e.errorCode
> + " " +
>             e.getMessage());
>          retval = null;
>       }
>       finally {
>          if (col != null) {
>             col.close();
>          }
>       }
>       return retval;
>    }
>   ...
>   similar routines to do xml related work
>   ....
>
>    public static void main(String[] args) throws Exception
>     {
>       ...
>       loop
>       {
>         get request from other programs, and call requested routine.
>       }
>      ...
>    }
> }
>
> --
> Jinsuo Zhang
>
> CISE department
> Univ of Florida


Re: process spawning

Posted by Jinsuo Zhang <ji...@cise.ufl.edu>.
On Mon, 25 Mar 2002, Mark J. Stang wrote:

> This is either a bug or something you are doing wrong.   Can you
send
> a sample of the code so the list can try and determine which it is?
>
> Mark
>
 
Hi, below is my code segment:
    Thanks for help.

public class DBXMLProxy
{

   public static String add_doc(String docname, String URI) throws
Exception {
      Collection col = null;
      String retval;
      try {
         String driver =
"org.apache.xindice.client.xmldb.DatabaseImpl";
         Class c = Class.forName(driver);


         Database database = (Database) c.newInstance();
         DatabaseManager.registerDatabase(database);
         col =

DatabaseManager.getCollection("xmldb:xindice:///db/mobiledata");

         String data = readFileFromDisk(docname);

         XMLResource document = (XMLResource) col.createResource(URI,
            "XMLResource");
         document.setContent(data);
         col.storeResource(document);
         retval = "1";
      }
      catch (XMLDBException e) {
         System.out.println("XML:DB Exception occured " + e.errorCode
+ " " +
            e.getMessage());
         retval = null;
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
      return retval;
   }
  ...
  similar routines to do xml related work
  ....

   public static void main(String[] args) throws Exception
    {
      ...
      loop
      {
        get request from other programs, and call requested routine.
      }
     ...
   }
}
      
-- 
Jinsuo Zhang

CISE department
Univ of Florida


Re: process spawning

Posted by "Mark J. Stang" <ma...@earthlink.net>.
This is either a bug or something you are doing wrong.   Can you send
a sample of the code so the list can try and determine which it is?

Mark

Jinsuo Zhang wrote:

>  In linux, Hundreds of threads/process, it keep increases until the
> system can not spawn new java thread/process.
>  thanks.
> --
> Jinsuo Zhang
>
> CISE department
> Univ of Florida
>
> On Mon, 25 Mar 2002, Mark J. Stang wrote:
>
> > Hi,
> > Count the number of xindice threads.   Is the number increasing as you
> > run your tests or is does it reach a maximum number and stop
> > increasing?
> >
> > Mark
> >
> > Jinsuo Zhang wrote:
> >
> > > Hi, Mark:
> > >    Thanks for answer.
> > >    I do close the collection explicitly by using col.close() after
> > > every request to database.
> > >
> > > --
> > > Jinsuo Zhang
> > >
> > > CISE department
> > > Univ of Florida
> > >
> > > On Mon, 25 Mar 2002, Mark J. Stang wrote:
> > >
> > > > According to Kimbro, everytime you create a collection, you are creating
> > > > a
> > > > thread.   In linux, each thread is listed as a process.   Are you
> > > > closing the
> > > > collection when done?
> > > >
> > > > Mark
> > > >
> > > > Jinsuo Zhang wrote:
> > > >
> > > > > hello,
> > > > >     Do I need to close database just like closing of collection?
> > > > > It seems it will generate hundreds of java process if only closing
> > > > > collection after a long time accumulation of this routine work.
> > > > > In linux, it behave this way, but in windows, no this strange
> > > > > behavior.
> > > > >    Thanks for help.
> > > > >
> > > > > --
> > > > > Jinsuo Zhang
> > > > >
> > > > > CISE department
> > > > > Univ of Florida
> > > >
> > > >
> >
> >


RE: process spawning

Posted by "W. Peschke" <Wo...@gmx.ch>.
Hi, we had similar problems when using xindice in linux cooperating with
tomcat.
In windows this seems not to be a problem.

The solution we now implemented was to create a class holding a set of
collections. These collections can be used by other classes. Call it a
kind of PoolManager. I now, that there are already implementations of
poolmanagers. Maybe this will help you.

By the way, we also had a bug, since we did not close all collections
which we opened.


W. Peschke

-----Original Message-----
From: Jinsuo Zhang [mailto:jizhang@cise.ufl.edu] 
Sent: Monday, March 25, 2002 7:15 PM
To: xindice-users@xml.apache.org
Subject: Re: process spawning


 In linux, Hundreds of threads/process, it keep increases until the
system can not spawn new java thread/process.  thanks.
-- 
Jinsuo Zhang

CISE department
Univ of Florida

On Mon, 25 Mar 2002, Mark J. Stang wrote:

> Hi,
> Count the number of xindice threads.   Is the number increasing as you
> run your tests or is does it reach a maximum number and stop 
> increasing?
> 
> Mark
> 
> Jinsuo Zhang wrote:
> 
> > Hi, Mark:
> >    Thanks for answer.
> >    I do close the collection explicitly by using col.close() after 
> > every request to database.
> >
> > --
> > Jinsuo Zhang
> >
> > CISE department
> > Univ of Florida
> >
> > On Mon, 25 Mar 2002, Mark J. Stang wrote:
> >
> > > According to Kimbro, everytime you create a collection, you are 
> > > creating a
> > > thread.   In linux, each thread is listed as a process.   Are you
> > > closing the
> > > collection when done?
> > >
> > > Mark
> > >
> > > Jinsuo Zhang wrote:
> > >
> > > > hello,
> > > >     Do I need to close database just like closing of collection?

> > > > It seems it will generate hundreds of java process if only 
> > > > closing collection after a long time accumulation of this 
> > > > routine work. In linux, it behave this way, but in windows, no 
> > > > this strange behavior.
> > > >    Thanks for help.
> > > >
> > > > --
> > > > Jinsuo Zhang
> > > >
> > > > CISE department
> > > > Univ of Florida
> > >
> > >
> 
> 



Re: process spawning

Posted by Jinsuo Zhang <ji...@cise.ufl.edu>.
 In linux, Hundreds of threads/process, it keep increases until the
system can not spawn new java thread/process.
 thanks.
-- 
Jinsuo Zhang

CISE department
Univ of Florida

On Mon, 25 Mar 2002, Mark J. Stang wrote:

> Hi,
> Count the number of xindice threads.   Is the number increasing as you
> run your tests or is does it reach a maximum number and stop
> increasing?
> 
> Mark
> 
> Jinsuo Zhang wrote:
> 
> > Hi, Mark:
> >    Thanks for answer.
> >    I do close the collection explicitly by using col.close() after
> > every request to database.
> >
> > --
> > Jinsuo Zhang
> >
> > CISE department
> > Univ of Florida
> >
> > On Mon, 25 Mar 2002, Mark J. Stang wrote:
> >
> > > According to Kimbro, everytime you create a collection, you are creating
> > > a
> > > thread.   In linux, each thread is listed as a process.   Are you
> > > closing the
> > > collection when done?
> > >
> > > Mark
> > >
> > > Jinsuo Zhang wrote:
> > >
> > > > hello,
> > > >     Do I need to close database just like closing of collection?
> > > > It seems it will generate hundreds of java process if only closing
> > > > collection after a long time accumulation of this routine work.
> > > > In linux, it behave this way, but in windows, no this strange
> > > > behavior.
> > > >    Thanks for help.
> > > >
> > > > --
> > > > Jinsuo Zhang
> > > >
> > > > CISE department
> > > > Univ of Florida
> > >
> > >
> 
> 


Re: process spawning

Posted by "Mark J. Stang" <ma...@earthlink.net>.
Hi,
Count the number of xindice threads.   Is the number increasing as you
run your tests or is does it reach a maximum number and stop
increasing?

Mark

Jinsuo Zhang wrote:

> Hi, Mark:
>    Thanks for answer.
>    I do close the collection explicitly by using col.close() after
> every request to database.
>
> --
> Jinsuo Zhang
>
> CISE department
> Univ of Florida
>
> On Mon, 25 Mar 2002, Mark J. Stang wrote:
>
> > According to Kimbro, everytime you create a collection, you are creating
> > a
> > thread.   In linux, each thread is listed as a process.   Are you
> > closing the
> > collection when done?
> >
> > Mark
> >
> > Jinsuo Zhang wrote:
> >
> > > hello,
> > >     Do I need to close database just like closing of collection?
> > > It seems it will generate hundreds of java process if only closing
> > > collection after a long time accumulation of this routine work.
> > > In linux, it behave this way, but in windows, no this strange
> > > behavior.
> > >    Thanks for help.
> > >
> > > --
> > > Jinsuo Zhang
> > >
> > > CISE department
> > > Univ of Florida
> >
> >


Re: process spawning

Posted by Jinsuo Zhang <ji...@cise.ufl.edu>.
Hi, Mark:
   Thanks for answer. 
   I do close the collection explicitly by using col.close() after
every request to database.

-- 
Jinsuo Zhang

CISE department
Univ of Florida

On Mon, 25 Mar 2002, Mark J. Stang wrote:

> According to Kimbro, everytime you create a collection, you are creating
> a
> thread.   In linux, each thread is listed as a process.   Are you
> closing the
> collection when done?
> 
> Mark
> 
> Jinsuo Zhang wrote:
> 
> > hello,
> >     Do I need to close database just like closing of collection?
> > It seems it will generate hundreds of java process if only closing
> > collection after a long time accumulation of this routine work.
> > In linux, it behave this way, but in windows, no this strange
> > behavior.
> >    Thanks for help.
> >
> > --
> > Jinsuo Zhang
> >
> > CISE department
> > Univ of Florida
> 
> 


Re: process spawning

Posted by "Mark J. Stang" <ma...@earthlink.net>.
According to Kimbro, everytime you create a collection, you are creating
a
thread.   In linux, each thread is listed as a process.   Are you
closing the
collection when done?

Mark

Jinsuo Zhang wrote:

> hello,
>     Do I need to close database just like closing of collection?
> It seems it will generate hundreds of java process if only closing
> collection after a long time accumulation of this routine work.
> In linux, it behave this way, but in windows, no this strange
> behavior.
>    Thanks for help.
>
> --
> Jinsuo Zhang
>
> CISE department
> Univ of Florida