C#: Handle count is getting increased

Hi,
I have developed an application in C# that is doing some database operations.
I am calling a method that is doing DB operation inside infinite do while loop and pausing the application for 1 second using Thread.Sleep(1000).
When I left the application running for 2 or more days then I came to know that handle count(Displayed in Task Manager) has increased about 40000 and its growing contineously...
Below is the sample code that I am using in my application:
private static void Process()
                try
                    do
                        if (oCon.State == ConnectionState.Closed || ((int)DateAndTime.DateDiff("n", DateTime.FromOADate(gDtHrConect),
DateTime.Now, FirstDayOfWeek.Sunday, FirstWeekOfYear.Jan1)) >= 20)
                            fReCon();
                        DoSomeDbOperation();
                        Thread.Sleep(1000);
                    while (true);
                catch
Please suggest why handle count is increasing? is this issue related to Threading?
high valume of Handles can create problem in the application?
Please do let me know if you need further details on this.
Thanks for your help.

Hello Pramod,
You could follow the suggestion from Joel, you could firstly comment out the “DoSomeDbOperation()” method to see if it then would work find without increasing the handle count. This would help narrow down this issue.
And with your description, this issue seems to be a handle leak, then you could also check this blog below which would help you find what type handles leak:
How to troubleshoot a handle leak
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Why handle count keeps increasing with active database connection?

    Hi,
    I have an application in which windows handle count keeps increasing..I did not find any reason why this is happening? could you please help me out? below is the code:
    I have also tried to close the database connection but not work.
    using System;
    using System.IO;
    using System.Data.Common;
    using System.Windows.Forms;
    using System.Threading;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    namespace SampleAppWithDbConnection
        class Program
            private static SqlConnection _oCon = null;
            public static SqlConnection oCon
                get
                    if (_oCon == null)
                        _oCon = new SqlConnection();
                    return _oCon;
                set
                    _oCon = value;
            public static int gIntervalo = 1000;
            [STAThread]
            public static void Main(string[] args)
                var gStrCon = ConfigurationManager.ConnectionStrings["Sql-ConnString-Token"].ToString();
                fConectaBase(oCon, gStrCon);
                fProcessa();
            private static void fProcessa()
                try
                    do
                        Thread.Sleep(gIntervalo);
                    while (true);
                catch (Exception)
            internal static bool fConectaBase(SqlConnection pCon, string pConnectionString = "")
                if (pCon.State != ConnectionState.Closed)
                    pCon.Close();
                pCon.ConnectionString = (pConnectionString == "") ? pCon.ConnectionString : pConnectionString;
                pCon.Open();
                return true;

    Hello Pramod,
    >>I have an application in which windows handle count keeps increasing
    If the windows handle(I assume you mean the object handles in Taks Manager bar) keeps increasing, it should means that the project keeps allocating new objects and does not close/dispose them. I notice that you are using ADO.NET API, I am wondering how you
    manage these connections, do you close/dispose the connection immediately after using them? If not, please do it and it is recommended.
    Please check if you call method to close/dispose connections in a finalize method, if so, this is not recommended since in a finalize method, these connections object would still keep alive and does not return to the connection pool, and for new connection
    request, application might increase more connection number to meet the request.
    You could make a test to call GC.Collect() to test if there is a memory leak, if it has, you could check this
    article, or it could be also a handle leak, this
    blog might be helpful for it.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SCOM 2012 - Event ID 6024 (Launching Restart Health Service. Health Service exceeded Process\Handle Count or Private Bytes threshhold.)

    I am getting event ID 6024 (LaunchRestartHealthService.js : Launching Restart Health Service. Health Service exceeded Process\Handle Count or Private Bytes threshhold.) within an interval ranging from 12-17 minutes.
    I am using SCOM (2012 SP1 and 2012 R2) on Windows Server (2008 R2 / 2012 / 2012 R2).
    This issue is occurring only on agent managed computer (acting as proxy and discover managed objects on other computers setting is enabled) which i am using for monitoring my device. All discovery scripts (powershell) and monitors are targeted on this agent
    managed computer.
    There are total 80 discoveries and 900 monitors. 55 discoveries and 550 monitors are enabled by default and rest all are disabled.
    I am seeing event id 6024 frequently only on agent managed computer. Can anyone help me to resolve this issue.
    Thanks,
    Mukul

    To fix issue 6024, you can follow below steps:
    1. Open SCOM console. Go to Monitors -> Agent -> Entity Health -> Performance -> Health Service Performance -> Health Service State.
    2. Double click Health Service Handle Count Threshold monitor and go to Overrides page.
    3. Click Override -> For a specific object of Class: Agent. Select the affected SCOM agent QMXServer.
    4. Check on the parameter Agent Performance Monitor Type - Threshold. Change the default value 2000 to an appropriate value, like 4000. You can check the Health service handle count alert in SCOM console to get the value when the alert is generated. You
    can also launch the health explorer against QMXServer to check the value when the monitor state is changed from healthy to critical.
    Also you can refer below links
    http://blogs.technet.com/b/omx/archive/2013/10/17/health-service-restarts-on-service-manager-servers-with-scom-agents.aspx
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical | Twitter:
    Mai Ali

  • [svn:fx-trunk] 11992: Ensure that the textFlow of a RichText always has a " damage" handler when you get it, so that when you mutate the textFlow the RichText updates.

    Revision: 11992
    Revision: 11992
    Author:   [email protected]
    Date:     2009-11-19 10:29:17 -0800 (Thu, 19 Nov 2009)
    Log Message:
    Ensure that the textFlow of a RichText always has a "damage" handler when you get it, so that when you mutate the textFlow the RichText updates.
    QE notes: None
    Doc notes: None
    Bugs: SDK-23869
    Reviewer: Carol
    Tests run: ant checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23869
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as

    Hey jerzeyzfynest,
    Unfortuantely, no -- Geek Squad Protection plans require that repairs be sought before a product is considered for replacement. This means your current laptop would only qualify for an exchange if one or more of the following conditions are met:
    A factory-authorized technician has determined that repairs cannot be completed
    A factory-authorized technician has determined that replacement parts cannot be obtained
    The unit has accrued two previous qualifying repairs a factory-authorized technician has identified a third qualifying hardware failure
    A detailed overview of this policy may be found in your plan documentation, as well as in the sample brochure available on the following site:
    http://bbyurl.us/TandC
    If your current laptop hasn't been performing up to par, then I'd encourage you to speak with a technician at your local store when you have the chance to do so. Diagnostic services are included in your service plan coverage, so we'd be glad to help find out what's going on.
    Aaron|Social Media Specialist | Best Buy® Corporate
     Private Message

  • Play Count does not increase

    Hey everyone...I've notice recently that when I have my iTouch connected to the computer and play a song the play count will increase, but if I'm just listening to it and then plug it back in, the play count has not increased. I listen to the songs in full, so I don't know why they won't increase in play count. Any ideas?

    i realise why Apple has changed this behavior....
    http://support.apple.com/kb/ht1202
    Now you can add music on multiple computers! (support page updated after iOS 5 introduction), thus playcount is no longer working when you are in Manually Manage Music mode... but instead of tracking individual libraries, they just kept it indepedent... and break the feature.
    Apple should've explained this... i lost some good playcount on my songs

  • SM04, AL08 active unknown users getting increased

    Hi All,
    While connecting through SAPGUi, getting an error
    "Application Server is overloaded currently"
    "Maximum no of connections terminals reached"
    If i checked in the sap system in "SMO4 and AL08" the no of unknown users is continually increasing" and these are showing as active users without any name.
    the user name is blank, and it continually increasing like this. we are having only 5 users created in the system.
    If i am terminating the users from SM04 and again its coming after refresh like this its increasing like 200, 3000....etc users.
    Due to this i am getting above mentioned error.
    Please help me on this, why the unknown users are getting increased and those are GUI users not RFC users.
    Please suggest, how t fix it and what may be the root cause
    Thanks in advance.
    Best Regards
    Vamsi

    Can you please paste the trace file dev_w0,dev_disp from the work directory.
    Also check this SAP note
    Note 1040464 - Blank row in SM04
    Try upgrading the kernel .
    Regards
    Ratnajit

  • Undo tablespace is getting increased

    Hi All,
    Oracle 9.2.0.1.0 version.
    The undo tablspace is getting increased, it gone more than 10 GB.
    Thanks for you suggestions

    Turn AUTOEXTEND OFF on your undo tbs and check DML operations on big tables.

  • The proxy server could not handle the request get /user/login in dbfw 5.1

    hi
    when i m login to oracle database firewall throuth internet explorer on the window xp client then the following error occur
    the proxy server could not handle the request get /user/login
    plz resolve issue
    Edited by: 913779 on May 15, 2012 6:29 AM

    Are you using a proxy? Check you settings.<BR><BR>
    ===============================================
    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings and disables most add-ons (extensions and themes).
    ''(If you're using an added theme, switch to the Default theme.)''
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu by clicking on the '''Restart with Add-ons Disabled...''' menu item:<br>
    [[Image:FirefoxSafeMode|width=520]]<br><br>
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.
    Thank you.

  • C7, Audio is getting increased automatically

    Hi,
    Am using Nokia C7, Right from the day one i have configured EMAIL (official and personal )account in Mobile,  Audio is getting increased automatically in my handset while am talking. In the receiving end, people are not able to listen my voice.
    It went to NOKIA care 5 times and finally they REPLACED my handset with NEW ONE. Still i faced the same problem.
    Only thing, what i did was, i have not configured my Mail account. Afterwards it worked properly.
    Today again old story. Audit is getting increased automatically in handset and receving end people are not able to hear my voice properly. They are facing difficult time in receving my call.
    I have the latest firmware in my mobile. 012.004.00.01
    IS THERE ANY FIX FOR THIS SOLUTION. IT MADE ME FRUSTRATED LIKE ANYTHING.
    Any Solution will be most welcome.  

    Hi , Thanks for your reply once again.
    But this problem is really annoying. I have even restored factory settings, after few hours, it started behaving as i told. I managed to give some air movement and tried, still same result.
    Am just wondering anybody have faced this problem. Bcoz, this is happening in the replacement C7 phone also provided by nokia.
    Once again,MY PROBLEM IS "MY MOBILE SPEAKER AUDIO GOT INCREASED, SUDDENLY AM ABLE TO RECEIVE THE OUTPUT OF MY PHONE THROUGH EXTERNAL BACK SIDE NOKIA C7 SPEAKER.
    DURING THAT TIME, PEOPLE FROM OTHER END ARE HAVING TOUGH TIME IN RECEIVING MY VOICE. MY VOICE IS EITHER FEEBLE OR AUDIO LEVEL IS GETTING VARIED.
    Any solution there please

  • 2012 Health Service handle Count Threshold

    I only have one server at present (a beefy one) for testing SCOM 2012 and with just 10 servers being monitored and only the AD, SQL, and Task Scheduler MP's installed, already the RMS is complaining that the Threshold for the
    Health Service Handle Count is over the top.
    Is this a case of simply adjusting the threshold from 6000 to a higher number?
    If so, what is the magic number pls?
    Thx very much,
    John Bradshaw

    Based on my knowledge the Healthservice handle count will go high when there is a huge alert flow mainly where there is lot of agents and when they throw lot of alerts.
    In our Environment of SCOM 2007 R2 we monitor Exchange 2010 and that is a quiet noisy MP.
    So there may be some agent which is throwing some collection / alerting data for which this count will go high.
    Request you guys to run the below SQL Query on the Ops DB to check which are those noisy alerts
    Most common events by event number and event publishername: (This
    gives us the event publisher name to help see what is raising these events)
    SELECT top 50 Number, Publishername, COUNT(*) AS TotalEvents
    FROM EventAllView
    GROUP BY Number, Publishername
    ORDER BY TotalEvents DESC
    and
    Computers generating the most events: (This
    shows us which computers create the most event traffic and use the most database space)
    SELECT top 50 LoggingComputer, COUNT(*) AS TotalEvents
    FROM EventallView
    GROUP BY LoggingComputer
    ORDER BY TotalEvents DESC
    refer: https://social.technet.microsoft.com/Forums/systemcenter/en-US/908db57b-4ed4-4b8e-8513-fd62965332ba/health-service-handle-count-threshold
    Gautam.75801

  • ITunes 11 - Songs less than 10 seconds long - Play count doesn't increase

    The title pretty much sums up my problem. Installed iTunes 11 a couple of days ago and have noticed that any track less than 10 seconds long (of which I have quite a few) will play okay in iTunes but the play count doesn't increase when the track finishes. Anything 10 seconds or above increments fine.
    However, if the same short tracks are played on the iPod then it is synced, the play count goes up no problems.
    Is this a "feature" of version 11 or a glitch does anyone know?

    I recently started having the same identical problem when playing iTunes on my computer (WinXP).  Songs play and move between computer and iPod without problems. Songs under 10 seconds are noticably affected. The number of plays and last date played do not increment.  Haven't seen longer songs affected but really haven't been watching until now.  In one case increased the song length from 10 to 12 seconds. It now works.  But songs that did work that are under 10 seconds, now don't. Currently using v 11.0.2.06.  Nothing new installed on computer.

  • How do i get increased storage?

    When I log onto elements 8 ,it tells me that my storage has reached a limit. I press `PROCEED`but it does not take me to a screen where I can get increased storage. What should I do ? Ron Sharpe

    Hello, Crafter Lady. 
    Thank you for visiting Apple Support Communities.
    You may find this article helpful when troubleshooting issues with iTunes Match.
    iTunes Store: Troubleshooting iTunes Match
    http://support.apple.com/kb/ts4054
    Cheers,
    Jason H.

  • Button's Event Handler Method not getting triggered

    To add a button I have written the following code:
    clear ls_button.
        l_import = 'Mass Upload'.
        l_enabled = 'X'.
        clear ls_button.
        ls_button-on_click = 'UPLOAD'. "IMPORT FILE
        ls_button-text     = l_import.
        ls_button-enabled  = l_enabled.
        INSERT ls_button INTO rt_buttons INDEX 5.
    Created a new Event Handler method for it and wrote the following code:
    gr_file_popup = comp_controller->window_manager->create_popup(
        iv_interface_view_name = 'ZSRQM_INCID_H/FileUploadwindow'
        iv_usage_name = 'ZCufileupload'
        iv_title = l_title ).
      gr_file_popup->set_on_close_event( iv_view = me iv_event_name = 'upload' ).
      gr_file_popup->open( ).
    When i run in th component in debug mode,my event is not getting triggered.
    Please suggest.
    Regards
    Najam

    Try the following code in first part...
    clear ls_button.
        l_import = 'Mass Upload'.
        clear ls_button.
        ls_button-on_click = 'UPLOAD'. "IMPORT FILE
        ls_button-text     = l_import.
        ls_button-page_id  = me->component_id.
        ls_button-enabled  = abap_true.
        INSERT ls_button INTO rt_buttons INDEX 5.

  • User Connections getting increase in Oracle 10g database

    Hi All,
    we have a java application setup in Websphere 6.0 server with Oracle 10g as a back end database.
    Our application server is load balanced by two seperate server.
    We found that there are more number of inactive connections getting established to database from application server.
    Those connections keep on increasing automatically though we closed all the session created through application.
    Is there any specific reason behind this. Currently we are killing those sessions manually.
    Kindly help me in resolving this issue.
    Thanks in advance.
    Regards
    Aruna

    The main reason for this is products like Websphere are stateless, and establish a connection for every statement, execute the statement and close the connection.
    Refrain from setting up connection pooling, either in Websphere or at the database site, and you will keep seeing this.
    As such it is not a database problem. It is a problem of developers who don't know connection pooling.
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read documentation.

  • Error handling workflow not getting triggered

    Hi all,
    I'm creating a outbound IDoc. And for error handling workflow.. I created a organization structure in PPOME and assigned users. I gave this position number thus created in the partner profile in post processing permitted agent tab.
    But when the Idoc is in error, this is not coming to my inbox.
    Can someone please help me with this.. and let me know what went wrong.
    Thanks in advance.

    Here you need to be careful,
    if the agent assignment is not maintained properly, there may be a chance everyone in the organization will get the item.
    I hope you have created a single workitem for error handling. goto additional data-> agent assignment-> maintain. make sure the attribute is defined as general forwarding allowed. or you maintain the role/position/user/whatever.as the possible agents. still you dont get the result, debugging the default rule in the task ->default rule -> agent.
    hope this helps.
    with regards,
    Sudhahar R

Maybe you are looking for

  • How do I write data back to DSO in visual composer

    I have created a model in visual composer that queries on a write-optimised DSO in BI. Basically I have created a form that lists the all the fields (like Quotations,Materials, plants) in vc. The business requirement is that the users should be able

  • How to add Freight Charges for SO Via B1WS

    I am using B1Ws for adding a new Sales Order. I want to enter Freight Charges details also. In DIAPI through expense code we can add but in b1ws what is the equivalent of that ? Can anbody guide me ? Thanks Vaithy

  • SAP entitlement system doesnot appear in CMC Authentication Screen

    Hi BO Experts, We are unable to Integrate SAP entitlement with BO Edge 3.1 Enterprise server because it doesn't appear in CMC console "Authentication TAB". BOE Version - 3.1 Integration Kit For SAP Solution - 3.1 SP2 Can some body please suggest what

  • Oracle Database Express Edition used in a standalone database

    I have been developing databases for years in Access. I have had alot of people want me to make databases for them. I do not want to make the databases in access and then have to worry about sending a database to a different state and then find out t

  • Configuring Synaptics touchpad (new Xorg again)

    Hi I'm one of those who upgraded to the latest Xorg recently. Now I can't figure out how to configure my touchpad scrolling. I don't have hal running (but only dbus). I have all the default Xorg config files intact (10-evdev, 10-quirks, 10-synaptics)