C main pgm creates too many local refs

Okay I give up ... I have a main program in C which calls methods in a helper class to read and write JMS queues. Right now it is leaking a local reference somewhere in the routine below, and I can't figure out where. Each time it calls this routine it seems to create one local reference which is not freed, eventually resulting in lots of "JNI local ref creation exceeded capacity" messages. (I assume that the local references are not cleaned up automatically because my main() function is in C rather than Java ... I haven't seen this addressed anywhere though.)
Anyway, the routine attached below is what my program calls each time through its loop. There is nothing on the queue for this test, so the return value of the method is always NULL.
Any help would be appreciated ...
Roy Goodman
Code follows ...
static JNIEnv *env;
#define CHECK_EXCEPTION() \
    if ((*env)->ExceptionOccurred(env)) { \
          (*env)->ExceptionDescribe(env); \
          logError( "Java exception encountered - see log file" ); \
          (*env)->ExceptionClear(env); \
          return JAVA_EXCEPTION; \
int receiveWait( const char *queueName, const char *url, int wait, ppMsg msg )
  static jmethodID mid;
  static jclass cls = NULL;
  jstring receivedMsg;
  jstring jQueueName;
  jstring jUrl;
  const char *tmp;
  if ( env == NULL )
    return JAVA_EXCEPTION;
  if ( cls == NULL )
    jclass lCls = NULL;
    lCls = ( *env )->FindClass( env, QUEUE_HELPER );
    CHECK_EXCEPTION(  );
    cls = ( *env )->NewGlobalRef( env, lCls );
    ( *env )->DeleteLocalRef( env, lCls );
    mid = ( *env )->GetStaticMethodID( env, cls, "receive",
                           "(Ljava/lang/String;Ljava/lang/String;I)Ljava/lang/String;" );
    CHECK_EXCEPTION(  );
  jQueueName = ( *env )->NewStringUTF( env, queueName );
  jUrl = ( *env )->NewStringUTF( env, url );
  receivedMsg =
    ( *env )->CallStaticObjectMethod( env, cls, mid, jQueueName, jUrl,
                          ( jint ) wait );
  ( *env )->DeleteLocalRef( env, jQueueName );
  ( *env )->DeleteLocalRef( env, jUrl );
  CHECK_EXCEPTION(  );
  if ( receivedMsg != NULL )
    int len = ( *env )->GetStringUTFLength( env, receivedMsg );
    tmp = ( *env )->GetStringUTFChars( env, receivedMsg, 0 );
    if ( tmp != NULL && *tmp != '\0' )
      *msg = malloc( len+1 );
      memcpy( *msg, tmp, len+1 );
    else
      *msg = NULL;
  else
    *msg = NULL;
  if ( receivedMsg != NULL )
    ( *env )->ReleaseStringUTFChars( env, receivedMsg, tmp );
  ( *env )->DeleteLocalRef( env, receivedMsg );
  return OK;
}

After further investigation, it seems that the references are being created to the QUEUE_HELPER class. Could this be a problem in CallStaticObjectMethod() where it creates a local reference that it doesn't delete?
Thanks again,
Roy Goodman

Similar Messages

  • Portal creates too many database sessions. fix doesn't work!!

    Oracle Database 9i, Application Server 9iAS,
    Operating System SUSE Linux 7.2
    CPU - Athlon 1400
    Ram - 1GB
    There is a modification for the http server that aims to eliminate a problem on unix that causes the database to create too many sessions. The script can be found at
    http://portalstudio.oracle.com/servlet/page?_pageid=1787&_dad=ops&_schema=OPSTUDIO
    However the script fails to work. The http server is on port 80 with the redirect on port 7778. However going to http://myhost/pls/ results in a server error - connection refused. Is it possible that there may be an error in the script.
    Thanks in anticipation

    ok so my sound is ok now I can check that off of the list... I just looked around and found some external USB speakers that work just right. My built in computer speakers are just not the best quality.
    As for the microphone, I still haven't been able to find out what is causing it to not work. I notice that it isn't actually broken since if I make a really loud noise right next to the input it will register a little but only a little bit.
    $ arecord -L
    null
    Discard all samples (playback) or generate zero samples (capture)
    pulse
    PulseAudio Sound Server
    default
    Default ALSA Output (currently PulseAudio Sound Server)
    sysdefault:CARD=Intel
    HDA Intel, ALC269 Analog
    Default Audio Device
    front:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Front speakers
    surround40:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    4.0 Surround output to Front and Rear speakers
    surround41:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
    surround50:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    5.0 Surround output to Front, Center and Rear speakers
    surround51:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
    surround71:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
    $
    here is some additional information about my sound. Also, when I open alsamixer, I find that when I go to "select sound card"(F6) I see default and HDA Intel. If the default is pulseaudio, then is it possible that pulseaudio is causing the problem?

  • Will Analyze create too many redo logs ??

    DB : 10gR2
    Hello Folks,
    Is analyze process creates too many redo log files ?? Is their any other valid option other than no log ?

    I guess that's also going to create too many log switches as it's part of DDLHUH?
    REDO log switches result from DML.
    If you are obsessed with LOG switches, then you need to use LOGMINER to observe the the relative per centage of changed data is from DBMS_STATS
    when compared to normal DML activity.
    I seriously doubt that DBMS_STATS has any significant impact to redo log switches.

  • Creat too many instance when writing an oracle database

    Hi
    I want to write Oracle database with database toolkits;
    but..i found there are too many instance or called session(exceed the upper limit) created when the program running .  that makes the Orace server stop responding
    Is there anything  i need to modify?
    Attachments:
    Oracle DB.vi ‏36 KB

    Frankly I have never seen this problem, but then I make a point of never using the database connectivity toolkit. Assuming a Windows platform, Windows implements something called connection pooling so when you "close" a connection the OS inserts it into a pool so If you ask for another connection it doesn't actually open a new one it just gives you back a reference to one of the ones you "closed" before.
    What OS are you running on?
    What version of Oracle?
    Is the instance of Oracle local or on another computer?
    How are you communicating with Oracle (odbc, oledb, etc)?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • IPhones w ActiveSync creating too many connections on mail server

    Over the past two days, I have started getting 503 errors, indicating too many connections. When I went to look at active connections, I noticed that the vast majority were from the iPhones that connect using ActiveSync. Just in the 45 minutes since I cleared all active connections, my iPhone has created 14 active connections. When you multiply that by the eight iPhones we have at this company the number jumps to 112. It is easy to see why the 503 error is getting generated by the end of the business day. It is as though the iPhone is unable to let go of an active connection, and just starts a new one. This only seems to be happening since the iPhone 3.0 update. Is anyone else experiencing similar issues?

    Yes - I'm having a very similar problem on our server. But in this case the user has a very large mailbox - and imap processes are spawned but never die unless I go in and manually kill them.

  • IWeb re-creates too many pages

    I understand the difference between "Publish" and "Publish All", but what I don't understand is why iWeb re-creates so many pages when I "Publish". If I work on three pages and then simply "Publish", the darn thing spends five minutes re-creating those three and a half-dozen other pages I didn't touch. Not the end of the world, but kind of annoying.
    Is there something I can do to eliminate this, or can someone at least help me understand why I am sitting and watching iWeb spin it's wheels for so long?
    Thanks,
    Bryan

    The strange thing is that:
    Even when the new page you are working on is in another site in iWeb the publish feature goes through some long process. While no files in the other sites are changed they are 'checked one by one,' making the publish process more tedious than it has to be.
    Since the nav bar is a part of the html code all pages in the site you add a page to must be modified. If you don't wish this to happen uncheck the checkboxes in the Inspector:
    1. Select the page and Open the Inspector
    2. Click on the page icon.
    3. uncheck 'include this page in the navigation menu.' and 'display navigation menu'
    iWeb makes it very easy to create your own nav menu. Just type in some text and select it. Then open the Inspector and click on the hyperlink icon. (Arrow icon) and select 'enable as hyperlink' From the pull down menu choose one of your pages in your site.
    Kurt

  • Photoshop CS6 creates too many History States withing 1 stroke

    I'm on MAC OSX 10.6.8, Photoshop CS6, using a Wacom Cintiq 12".
    Too often Photoshop remembers way too many History states within one pen stroke. In previous versions I don't remember this behaviour. Previously, each stroke, no matter how long, was registered as only one History state, until I raised the pen from the tablet. Now, totally sporadically without any obvious rule, Photoshop decides to remember even 100 history states within only one stroke.
    Although this is sometimes useful, if you work on really long strokes, but mostly it's highly disturbing, as after using just one tool to paint only one little circle, I loose all my other, much more important History states.
    Can somebody explain to me why???

    Noel Carboni wrote:
    Done with a mouse I get exactly one "Brush Tool" state in the history and one "Use brush" state recorded in an action.
    Could it be that your tablet driver is actually delivering information to Photoshop that makes it think you're lifting the stylus and putting it down many times per stroke?
    -Noel
    Hmmm... could be, but I don't know how to test it, as it happens occasionally... I don't experience it in other software, but I will keep an eye on that.

  • SDDM 3.1 PROD: Engineer to Relational creates too many new objects

    After upgrading to DM 3.1 production I am seeing many dublicates of my relational tables. It seems that when I perform "Engineer to Relational", some of the tables are recreated even though they already existed in the relational model.
    Currently, I have the following tables in my relational model:
    PARTIES
    PARTIESv1
    PARTIESv2
    PARTIESv3
    PARTIESv4
    PARTIESv5
    PARTIESv1-v5 have a created date of Februrary 15 or later, so they have all be created after my upgrade to DM 3.1 production.
    Is this a known bug, and will it be fixed by the upcoming patch?
    Regards,
    Marc de Oliveira

    Marc,
    I have not been able to reproduce this problem.
    I assume that the problem occurred on a model you had migrated from an earlier release? If so, was the migration from 3.0 or from 3.1 EA1, EA2 or EA3? And was this where the model was initially created, or had it been migrated previous to this latest migration?
    I assume that the Entities had been Engineered to Relational prior to the migration?
    Is it happening to all your Tables? If not, are there any obvious similarities between the Tables that have the problem?
    Any other information that might help us reproduce this problem would be appreciated. Do you use any special options in your Engineer operation?
    David

  • ORA-02045: too many local sessions participating in global transaction

    Hi,
    this is related with the solution that I got from my previous post in
    modify LONG column using trigger
    that solution work in my local schema. But when test this in the real application,
    I got above error.
    can I know what is the reason?
    thanks

    Hi Michael,
    below is my code
    I created the loopback db link as follows
    CREATE PUBLIC DATABASE LINK "DEV_LOOPBACK.MYDOMAIN.COM" 
        CONNECT TO "DBLINK_USER"
        IDENTIFIED BY "********" 
        USING 'DEV' trigger as follow
    CREATE OR REPLACE TRIGGER TEST_TABLE_MEMO_AFT_UPD
    AFTER UPDATE
    ON TABLE_MEMO
    FOR EACH ROW
    DECLARE
      myCOLNAME VARCHAR2(20);
    BEGIN
      IF :NEW.COL_NAME = 'FC_NOTE' THEN
        myCOLNAME := :NEW.COL_NAME;
        EXECUTE IMMEDIATE
          DECLARE
            Original_Char VARCHAR2(32767);
            Fixed_Char VARCHAR2(32767);
          BEGIN
            SELECT MEMO INTO Original_Char FROM TABLE_MEMO@DEV_LOOPBACK WHERE RECNO = :1 AND COL_NAME = :2;
            UPDATE MBS_OWNER.TABLE_MEMO@DEV_LOOPBACK SET MEMO = REPLACE(Original_Char,chr(141),CHR(13)) WHERE RECNO = :1 AND COL_NAME = :2;
          END;
        ' USING :NEW.RECNO,myCOLNAME;
      ELSE
        NULL;
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
        raise_application_error(-20005,SQLCODE||' TRIGGER ERROR AFTER UPDATE '||SQLERRM);
    END;Note:
    with adding a loopback dblink, now I have 5 dblink active in the DB.
    My Open_Links parameter set to 4 and I don't have INIT.ORA
    thanks
    Lie

  • Exporting clickdummy as "html + images" creates too many gifs

    Hi, I created a prototype in Fireworks, exported as "HTML and Images". There are multiple pages and a few slices. My problem now is the images folder. It's huge. There are thousands of gifs. Is this normal? I wanted to provide this prototype via an online link, but you mostly see the images loading from top to bottom when opening any page. It's annoying. Working offline from desktop is fine of course.
    Do I have to reduce the number of sclices so that there are fewer gifs in the image folder? I would have to cick off some hover states... or is there any other way to reduce the number of images the page is build of?
    Thanks for any help and advice!
    Mari

    OK, thanks, that already helped me. But unfortunately I didn't manage to create these html-text slices. There are just green solid boxes where I can enter html text but I dont know how to transfer my different text areas in combination with images to html + image slices. Do I have to slice up the whole page?
    After trying and studying the article you mentioned above I exported as Css and Images and now my page consists of html text and some images, looks nice and is edidable in Dreamweaver. But with this method I loose all the hover functionality. In which direction should I work on?
    A export as Css and Images and try to insert the hover and swap-image functionality manually in Dreamweaver or
    B export as Html and Images and try to learn how to add html text slices?
    Thanks again!
    Mari

  • Airports are creating too many separate networks, how to fix?

    Here's a picture of my current setup.  I have 1 Airport extreme that creates a 2ghz and 5ghz network.  It travels via ethernet to a airtport express 2G that creates  2ghz and 5ghz networks of the same name as the Airport etreme.
    Within that whole setup I have 2 Airport express' extending the 2ghz network which I believe is creating my problem.....
    With this whole setup some sections of my home get these results:
    It's quite annoying especially when streaming airplay because my iphone or such device will jump back and forth between the two networks making the music stream choppy.
    How would I make both the networks merge as one?  Is there a way to extend a network using ethernet as the connection instead of wifi??

    Oh wow, I feel like a fool, how did i not catch that >.<
    Also one last question, should I allow the 2nd gen express' network to be extended whil I'm already allowing the airport extreme as well?
    Thanks I'm pretty sure you fixed this

  • FindByPK creates too many instances

    Hi all,
    When using JBoss (I don't know other servers behavior) the findByPrimaryKey method creates a "home instance".
    I think that JBoss need a "home instance" for finder methods and it could create only one to do that, but, in fact, it creates a new instance for each call and doesn't reuse it.
    For example:
    Integer pk = new Integer(1);
    First findByPrimaryKey(pk): 2 instances created (Home instance and Bean instance)
    Secound findByPrimaryKey(pk): 1 instance created (Home instance)
    Third findByPrimaryKey(pk): 1 instance created (Home instance)
    The ejbLoad method is called only on the first call (it's my configuration).
    Any idea?
    Thank you,
    Denis.

    Hi Denis,
    Check your deployment descriptor - maybe you've
    mistyped the remote interface for the home interface.
    If I'm not mistaken, finder methods should return
    remote, not home interfaces.
    DimitarI think Denis meant a new HomeImpl (or whatever it's called) instance is created each time in the container to receive the home.findByPrimaryKey() request.
    As such requests are stateless, one would expect the container to direct several of them (at least when they are serial and not in parallel) to only one instance of HomeImpl.
    But it's a container decision. The container is free to instantiate a pool of HomeImpl, or one HomeImpl for each request,...
    As far as EntityImpl instances go, it's not surprising that only one instance is created and that ejbLoad() is called only once, as long as the instance created first is still alive and active.
    Not surprising but not obvious either : the container would be free to create several instances representing the same entity, provided it ensures transactionality (that seems one way of ensuring isolation of concurrent container-managed transactions on the same entity).
    So in general one shouldn't rely on the instantiation of the Java object representing the implementation of a Home or a Remote as it may vary per container.
    Now I think Denis' concern may be : does such an approach of creating a HomeImpl instance each time scale?

  • Too many connections - even after closing ResultSets and PreparedStatements

    I'm getting a "Too many connections" error with MySQL when I run my Java program.
    2007-08-06 15:07:26,650 main/CLIRuntime [FATAL]: Too many connections
    com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Too many connections
            at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
            at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)
            at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3269)
            at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1182)
            at com.mysql.jdbc.Connection.createNewIO(Connection.java:2670)I researched on this and found out that I wasn't closing the ResultSet and the PreparedStatement.
    The JDBC connection is closed by a central program that handles connections (custom connection pooling).
    I added the code to close all ResultSets and PreparedStatements, and re-started MySQL as per the instructions here
    but still get "Too many connections" error.
    A few other things come to mind, as to what I may be doing wrong, so I have a few questions:
    1) A few PreparedStatements are created in one method, and they are used in a 2nd method and closed in the 2nd method
    does this cause "Too many connections" error?
    2) I have 2 different ResultSets, in nested while loops where the outer loop iterates over the first ResultSet and
    the inner loop iterates over the second ResultSet.
    I have a try-finally block that wraps the inner while loop, and I'm closing the second ResultSet and PreparedStement
    in the inner while loop.
    I also have a try-finally block that wraps the outer while loop, and I'm closing the first ResulSet and PreparedStatement
    in the outer while loop as soon as the inner while loop completes.
    So, in the above case the outer while loop's ResultSet and PreparedStatements remain open until the inner while loop completes.
    Does the above cause "Too many connections" error?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The following is relevant sections of my code ( it is partially pseudo-code ) that shows the above 2 cases:
    init( Connection jdbcConnection ){
       String firstSQLStatement = "....";
       PreparedStatement ps1 = jdbcConnection.prepareStatement( firstSQLStatement );
       String secondSQLStatement = "....";
       PreparedStatement ps2 = jdbcConnection.prepareStatement( secondSQLStatement );
       String thirdSQLStatement = "....";
       PreparedStatement ps3 = null;
       ResultSet rsA = null;
       try{
            ps3 = jdbcConnection.prepareStatement( thirdSQLStatement );
            rsA = ps3.executeQuery();
            if( rsA.next() ){
                   rsA.getString( 1 );
       }finally{
            if( rsA != null )
                   rsA.close();
            if( ps3 != null )
              ps3.close();
       //Notice, how ps1 and ps2 are created here but not used immediately, but only ps3 is
       //used immediately.
       //ps1 and ps2 are used in another method.
    run( Connection jdbcConnection ){
         ResultSet rs1 = ps1.executeQuery();
            try{
               while(rs1.next()){
                    String s = rs1.getString();
                    ps2.setString(1, s);
              ResultSet rs2 = ps2.executeQuery();
                    try{
                   while(rs2.next()){
                        String s2 = rs2.getString();
                    }finally{
                   if( rs2 != null )
                     rs2.close();
                   if( ps2 != null )
                     ps2.close();
         }catch( Exception e ){
              e.printStackTrace();
         }finally{
            if( rs1 != null )
                  rs1.close();
               if( ps1 != null )
                  ps1.close();
    //Notice in the above case rs1 and ps1 are closed only after the inner
    //while loop completes.
    }I appreciate any help.

    Thanks for your reply.
    I will look at the central connection pooling mechanism ( which was written by someone else) , but that is being used by many other Java programs others have written.
    They are not getting this error.
    An addendum to my previous note, I followed the instructions here.
    http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html
    There's probably something else in my code that is not closing the connection.
    But I just wanted to rule out the fact that opening a PreparedStatement in one method and closing it in another is not a problem.
    Or, if nested ResultSet loops don't cause the problem.
    I've read in a few threads taht "Too many connections" can occur for unclosed RS and PS , and not just JDBC connections.

  • Please organize osx launchpad icons in CS6 collection(there are too many adobe icons)

    Adobe applications create too many icons in launchpad on osx. Is there a way to automate organising them in a more elegant fashion? Launchpad gets full of red adobe icons(2 pages of them) especially if you have master collection installed. Please put them all in one folder or something.

    Thanks for your input here. We will look into it to see if there is an improvement we can make in the future.
    Pattie

  • Too many connections to call SAP functions

    Hello everyone,
    I'm having a random problem while accessing SAP functions on my applications.
    Sometimes i get this message:
    Could not create JCOClientConnection for logical Systems: WD_MODELDATA_DEST - Model: class com.xxx.sap.NameController.
    Please assure that you have configured the RFC connections and/or logical system name properly for this model.
    A friend tells me that this has to do with the fact that i use one model per SAP function ,
    and a custom controller for each unique model.
    This creates too many connections and launches the error.
    Can anyone tell me how to solve this problem without
    having to reimport all my functions into one single model  and one single custom controller ??
    My biggest problem is that doing that would increase the time spent on project development dramatically.
             Thank you everyone,
                  Nuno Santos

    Hi Guillaume,
    My answers:
    1. All connections are closed by time-out, but i would really apreciate if someone could explain how to explicitly close them after calling them.
    2. No. That is the big problem. This was my first project, and in a very simplistic (and stupid) way i created a webdynpro model for each SAP function that i call. This means that an application may call 5 or 6 functions during it's runtime, meaning 5 or 6 connections. Multiply this by a few hundred users...
    What are my choices here?
    Help will be really apreciated.
       Thanks to everyone,
           Nuno Santos

Maybe you are looking for

  • A long list of complaints that no one at BT will a...

    I was a customer of BT for about 2 years and before that had always had a BT landline in properties I lived within and never found any problems with their service until I came to moving house and then some very serious customer service problems start

  • Is the data plan required?

    I'm currently planning on purchasing an iPhone, but am just wondering whether the extra data plan charge(I'm currently an AT&T customer) is required to use the phone. I don't plan on using it for the internet or email, since I can just do that at hom

  • Lost videos in iPhoto during transfer when computer crashed??

    I was transferring videos from my iphone 4s to my Powerbook G4 and by default it transfers to my iPhoto account. A prompt came up that the photos (and videos) were transferred sucessfully and asked me if I wanted to keep or delete the photos from my

  • IPhoto is crashing 30 seconds after opening

    Every time I open the program crashes.  I've deleted and reinstalled twice with the same issue.  I've also booted while pressing option and tried to create a new library, but it crashes 30 seconds in without fail.  Please help! I have a lot of photos

  • Moved itunes library folder

    i moved my itunes library by mistake. i've learned that if the folder gets moved, itunes will create a new and EMPTY library the next time it is opened. well, this has happened to me. is there any way to restore the old library back into itunes? emai