Multi-thre​aded error handling method

I have a multi-threaded application.  When an error occurs in any of the threads which causes the system to fail, all of the threads throw an error and display an error dialog box.  I am thinking about removing the call to the error handler in the secondary threads and instead send the error to the main thread for disposition.  Is that a common design pattern?  Is there a better way to do this?
Solved!
Go to Solution.

kc64 wrote:
I have a multi-threaded application.  When an error occurs in any of the threads which causes the system to fail, all of the threads throw an error and display an error dialog box.  I am thinking about removing the call to the error handler in the secondary threads and instead send the error to the main thread for disposition.  Is that a common design pattern?  Is there a better way to do this?
Not as common as it SHOULD be.
We use an Event Logger that passes all errors to a background process that logs them to file for review later. That is the minimum. If the errors a fatal then we adjust the app design to react accordingly when bad things happen.
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Multi-thre​aded Sequences,​Threads and tracing

    Am writting a custom OI in LabView. Got a issue which is causing a fair amount of head ache. I'm using the trace message to find out what is executing and displaying the data in the appropriate form.
    However, I've notice that when sequences go off and execute in thir own threads(Multithreaded - 'Run Sequence in New Thread') there doesn't appear to be any trace messages coming back from thouse spawned threads. I've had a good look at thi but still can;t seem to figure out why.
    Basically I need those trace messages.....

    Wojtek -
    The default operator interfaces only support tracing one active thread at a time. Each operator interface has a thread control that allows you to switch between threads.
    There is an option ExecMask_TraceAllThreads which specifies to send trace events for all running threads in an execution. This option can be set on Engine.NewExecution, but keep in mind that the OI must be able to support this option. When the TestStand sequence editor and operator interfaces launch new executions, they do not set this option.
    Scott Richardson
    National Instruments

  • What is Considered Best Practice for Error Handling in Components?

    What would be the best approach to handling errors in custom (possibly composite) components?
    I see three different possibilities:
    Having the error handling funciton within the component. The problem is that this is not adaptable to the consumers error handling setup (i.e. logging to database, redirecting to a pretty error screen, etc.).
    Passing in an error function as a parameter. The problem here is how to have the externally defined error function interact with external elements that are not defined within the component, i.e. passing the error or fault object to a logging class, or something similar, of which the component knows nothing about.
    Referencing the external error handling methods directly from within the component. (Of course that's shabby programming, just listing as a technical option.)
    How do you solve this?
    My goal is to have a versatile custom component that can utilize any given consumer's error handler.
    Thanks,
    Mike

    or define a customized event and dispatch it when error occur, then you can just listen to it outside

  • 'Structured' error handling and reentrancy

    The parentheses in the subject are due to the fact that I'm not using the Structured Error Handler reference library, but have rolled my own to do something similar but in the manner I want it to. I don't actually use the SEH (haven't even got it installed at the moment on this PC) so am not sure exactly how it works under the hood.
    I have a reasonably large application with a number of distinct parallel modules (GUI, state module, communication, motion control). The final parallel module is an error handling module. This consists of two queues - one for incoming errors, and one for outgoing actions. Errors are dequeued and their codes checked for their category (critical, warning, ignore or unclassified, for instance) and the appropriate category is returned to a local error handler via the action queue. When an error is passed to a local error handler VI, it enqueues the error to the main handler and waits for a response to that particular error.
    This all works nicely, in much the same way the SEH would do. However, with either the SEH or my local error handler method, I find myself wondering how often to place these down and the consequences of doing so. If they're non-reentrant, I imagine I may end up with lots of parallel processes sitting patiently to access the VI as it's blocked by another, causing jitter. If I go pre-allocated clone, I could potentially have many many callers using this function, which strikes me as a bit of a waste of resources. My gut feel is to go with shared-allocation clones, as the vast majority of the time it'll be no error passed through an empty case, and not to place them in absolutely every subVI - just perhaps after a state executes in the state handler, in all the parallel loops of the submodules etc.
    Just wondering what anyone else does with their error handling solution, and whether my thoughts make sense.
    CLD

    Having chatted to my friendly neighbourhood Spiderman Architect, he suggested I should probably just stop being a wimp and just use pre-allocated clones to avoid the jitter and to stop worrying about the resource hit, as you suggest
    I'll use the same code on both PC host and RT host, hence the jitter concerns on the RT.
    Thanks for the thoughts!
    CLD

  • Lsmw error handling

    Hi, all
    wat r the error handling methods in lsmw, Can any body explain.

    Hi Tanmay,
    During the Mapping and Convertion step where you have assigned your input file fields to the recording fields, you can add some ABAP code to validate the field contents and write out an error message or output to an error file, with field contents if required.
    If you are familiar with ABAP this should be no problem for you.
    Regards
    Kevan

  • General error handling operation

    Hi,
    I did not find a comprehensive explanation how error handling works in TestStand, only bits and pieces about the callbacks (perhaps I looked at the wrong places).
    Anyway, I made some experiments with SequenceFilePostStepRuntimeError and StationPostStepRuntimeError - intentionally leaving out ProcessModelPostStepRuntimeError to reduce complexity - and came up with the attached flow chart. I would like to know:
    if that shows the correct operation of TestStand error handling (we are currently using 4.1, about to switch to 2010 or 2012, so it would also be interesting to know if anything changes with the new versions)
    if it is always the case that the combination of ErrorReported=True und Error.Occurred=True after the error handler leads to termination of the execution? I could not find any setting governing that (the "goto cleanup immediately" setting of the sequence was off;
    Best regards
    Peter
    Attachments:
    TestStand_ErrorHandling.png ‏36 KB

    Hi Peter,
    1) Every step has :
    error.code   - to set the error code
    error.occured - boolen if set true displays a popup error message to the user
    error.message - the popup contains this message
    when you set error.occured=true it will bring up a popup message with the error.message and error.code.
    Please note that this may not be acceptable in the manufacturing environment where operators may not be trained to check for errors.
    The general practice in manufacturing is to fail all important steps that errors out so that the final result is failed.Then do a offline analysis.This is done by step.results.status = "Failed".You can also populate step.results.ReportText with proper values so that your test report reflects the type of error/failure.
    2) Regarding the  SequenceFilePostStepRuntimeError and StationPostStepRuntimeError - they are optional error handling methods if you want to act on errors.
    3)Every step has an option ( look for properties-->post actions).On Pass or On fail destinations can be set for each step.Cleanup is always executed except in cases of abort.
    4) In the menu configure-->Station options-->execution there is an option for runtime errors ( one of them is run cleanup).
    Hope the above information helps.

  • Unable to achieve Error Handling

    Hi All,
    Within my method call I invoke a error handler method but this does not seem to function. The code is as enclosed below can someone let me know as to why please.
      public void onActionContactPersonalizationPressed(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionContactPersonalizationPressed(ServerEvent)
         this.checkMandatory("ProductCategory");     
         this.checkMandatory("ProductFamilySel");
         this.checkMandatory("ProductSel");
         this.checkMandatory("ContractManager");
         this.checkMandatory("ContractStartDate");
         wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
         wdThis.wdFirePlugExitCustPOCtoCP();
        //@@end
    // Error handler method
      public void checkMandatory( java.lang.String fieldName )
        //@@begin checkMandatory()
        IWDMessageManager msgMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();
        Object attVal = this.wdContext.currentContextElement().getAttributeValue(fieldName);
        IWDAttributeInfo attInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);
        if(attVal instanceof String){
             if(((String)attVal).length() == 0){
                  msgMgr.reportContextAttributeMessage(
                  this.wdContext.currentContextElement(),
                  attInfo,
                  IMessageHPBBankingProductOffering.MISSING_INPUT,
                  new Object[] {fieldName},
                  true);
        //@@end
    Thanks in advance.
    Best regards,
    Divya

    Hi All,
    I have now changed it to the code enclosed below:
      public void onActionContactPersonalizationPressed(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionContactPersonalizationPressed(ServerEvent)
         this.checkMandatory("ProductCategory");     
         this.checkMandatory("ProductFamilySel");
         this.checkMandatory("ProductSel");
         this.checkMandatory("ContractManager");
         this.checkMandatory("ContractStartDate");
         String selPdDesc = (String)wdContext.currentContextElement().getAttributeValue("ProductSel");
         wdContext.currentContextElement().setProductSelDesc(selPdDesc);     
         if( !wdThis.wdGetAPI().getComponent().getMessageManager().hasExceptions() ){
         wdThis.wdFirePlugExitCustPOCtoCP();
        //@@end
      public void checkMandatory( java.lang.String fieldName )
        //@@begin checkMandatory()
        IWDMessageManager msgMgr = this.wdThis.wdGetAPI().getComponent().getMessageManager();
        Object attVal = this.wdContext.currentContextElement().getAttributeValue(fieldName);
        IWDAttributeInfo attInfo = this.wdContext.getNodeInfo().getAttribute(fieldName);
        if(attVal instanceof String){
             if(((String)attVal).length() == 0){
                  msgMgr.reportContextAttributeMessage(
                  this.wdContext.currentContextElement(),
                  attInfo,
                  IMessageHPBBankingProductOffering.MISSING_INPUT,
                  new Object[] {fieldName},
                  false);
        //@@end
    Still doesn seem to work.
    Can someone state as to why?
    Thanks in advance
    Best regards,
    Divya

  • View not copied or enhanced with wizard Error while creating Event Handler method in Z Component

    Hello Friends,
    In one Z Component (Custom Component), in one of the views, while creating event handler, it gave me error message that view not copied or enhanced with wizard.
    I am aware that in Standard Component, if we want to create the event handler method then we need to first Enhance the Component and then we need to enhance the view.
    But, in the Z Component (Custom Component), how to create event handler method in one of the views as while creating event handler method i am getting view not copied or enhanced with wizard error.

    Hi,
    Add a method in views impl class with naming convention eh_on__* with htmt and html_ex parameters.  I dont have have the system right now. Please check any existing event import export parameters.
    Check out do handle event method in the same class.
    Redefine that method.  Call that event method in this handle method. See existing code for reference.
    Attach that event to the button on click event in .htm page.
    Regards,
    Bhushan

  • Getting error in event handler method onPlugFromStartView

    Hi,
           I am getting error in event handler method onPlugFromStartView java coding. The error message is u201CThe method wdGetwelcome componentcontroller() is undefined for the IPrivatevieew.
    Plese explain how to resolve this error to deploy the webdynpro application successfully.
    Thanks,
    Kundan.

    Hi
    1.It seems some thing corrupt or some problem .
    2. Do one exercise Create one new Dc --component -View ,In component write one method.
        a)  Open the view and then try to add that component.
    Let us know the result
    Best Regards
    Satish Kumar

  • Error handling in overridden methods in AbstractPageBean

    Hi,
    I'm writing a small app in JSF. One of the pages populates a bunch of text fields from an XML file whose name is passed into the app as an initialization parameter. The purpose of the page is to allow editing of the fields.
    It seemed that the prerender() method was the right place to initialize the fields in the form. I have an application-scoped bean trying to open the XML file. I don't want the app to barf on initialization if the file doesn't exist, because the application contains the logic to create the file. So it just sets the appropriate forward target ("file does not exist" page, or maybe XML parse error) and lets the pages that use those bean properties decide when and if they need to display the initialization error page.
    I would like to throw an exception from the prerender() method in my page, and have the error handling specified in web.xml. The problem, of course, is that I can't throw my own exception from prerender().
    So, have I got the wrong place to initialize my form, or do I have to throw a javax.faces.FacesException, or have I got this whole error-handling thing wrong?
    Any advice would be gratefully received.
    Many thanks.
    Regards,
    Mike
    public void prerender(){
            // Get ApplicationBean1 to forward the request if we fail to
            // initialize properly.
            ApplicationBean1 ab1 = getApplicationBean1();
            HttpServletRequest req = (HttpServletRequest) this.getFacesContext().
                    getExternalContext().
                    getRequest();
            HttpServletResponse res = (HttpServletResponse) this.getFacesContext().
                    getExternalContext().
                    getResponse();
            if(!ab1.isInitialized()){
                //The initialization code for ApplicationBean1() sets the
                //target when it detects an error and then forwards the
                //request to that target upon invocation of the forwardRequest
                //method
                ab1.forwardRequest(req,res);
            // These are the input components
            tfClonebase.setValue(ab1.getClonebase());
            tfDhcpdconf.setValue(ab1.getDhcpdconf());
            tfNamedrev.setValue(ab1.getNamedrev());
            tfNamedzone.setValue(ab1.getNamedzone());
            tfPxelinux.setValue(ab1.getPxelinux());
            tfXmldir.setValue(ab1.getXmlDir());
        }

    Well, I'm certainly no expert, but prerender() is called, as you might expect, just before rendering takes place (but only if the page will actually be rendered). This means it won't be called for a page that handled a postback but then navigated to a different page. Good place to handle initializations that happen before rendering.
    So my thinking was that I could initialize stuff before there's anything in the response, making it easier to bail out if something goes bad.
    But I really can't work out the right way to bail out: I can't throw my own exception because the prerender() is overridden from AbstractPageBean. So I suppose I could create a MikesBadInitException e and throw it inside a new javax.faces.FacesException(e). But I'd like to specify an error-page in my web.xml for MikesBadInitException, and don't want to handle all javax.faces.FacesExceptions, if you get my drift.

  • Populating database tables in event handler method - error

    Friends,
    I am trying to insert values into ztable in an event handler method in a WDA application.
    This is the code. ZDATA1 is a ztable with two fields: MANDT and ZKTOKD of data element char01.
    types: begin of zs,
    zktokd type char01,
    end of zs.
    data: zitab type table of zs,
    zstruct like line of zitab.
    zstruct-zktokd =  's'.
    append zstruct to zitab.
    INSERT zdata1 FROM TABLE zitab.
    I am getting the error: "The Work area "ZITAB" is not long enough...
    Please let me know what is missing.
    Thanks and Regards.

    Hi,
    The error is here
    types: begin of zs,
    zktokd type char01,
    end of zs.
    data: zitab type table of zs ,
    zstruct like line of zitab.
    "passed the Internal table name which is wrong
    Correct one
    data:
    zitab type table of zs,
    zstruct like line of ZS. " Here we have to give the type you have declared above.
                                    " Zstruct acts like a workarea.
    Regards
    Lekha

  • Error in event handler method in window

    Hi,
    I have created configuration in SEFVISU, to receive the workitem i have created a parameter in event handler method in window
    but it is throwing dump The ASSERT condition was violated, if i remove that parameter means application executing properly but i am not able to pass the unique, values please guide me.
    Regards,
    Srini.

    Hello Srini,
    are you talking about the default event handler method of the window? if so then you need to ensure that the parameter name defined in the event and passed in name are same. And also its better to go for the parameter type as STRING.
    other option would be instead of defining the static parameters in the event handler method, you can get the parameters from the WDEVENT itself by accessing WDEVENT->PARAMETERS table.
    hope this helps.
    BR, Saravanan

  • Is this a qucik and satisfactory method for CLD error handling? (see image)

    http://i.imgur.com/IiI8D1w.png
    with reference to: http://i.imgur.com/TyNVWQX.png (from success package document)
    Is this too simple an error handler setup?  Assuming non-catastrophic errors are taken care of before leaving any case in my qsm?  An error is only acceptable during debugging isnt it? (unless instructed by requirements?)  
    I'm trying to think of ways to save some time as I've been working so much I let my test date creep up on me...  
    Thanks
    Solved!
    Go to Solution.

    PatLyons wrote:
    Is this too simple an error handler setup?
    In the real world, yes.  For the CLD, that is a minimum to get the points.  Just throw down the Simple Error Handler to show the error dialog and you have "handled the error".  If the spec does not say how to handle the error, stop the loop(s) and show the error dialog.  If you are given a spec of how to handle the error, do whatever you are told.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Report and Alert don't executed in the error handler with a JMS proxy service

    Hi,
    I'm working with OSB 11.1.1.4.0 and I'm facing a problem with the error handler of my JMS proxy service.
    My error handler contains two main elements :
    - a Report action
    - an Alert with a JMS destination defined
    When the business service failed the message remain in the queue. It's the expected behavior.
    The problem is :
    - the report is missing
    - the alert is raised but missing in the JMS destination defined in the Alert setting.
    I've noticed if I add a Reply with Failure or Success, Report and Alert are successfully executed.
    Unfortunately the message don't remain in the JMS queue.
    What can I do in order to have my report/alert done and the JMS transaction rollback in order to keep the message in the queue ?
    I've already met this problem in the past with alsb v3 and my solution was to add Service Callout in the error handler in order to externalize these actions.
    This solution is not convenient and I hope another solution is possible.

    Inventorying workgroups can be difficult, especially when it comes to remote access and network security. Because workgroups are not centrally managed, some of the items discussed in this
    wiki article on preparing your workgroup environment may require you to visit each machine individually.
    For non-domain credentials, you do not use the <systemname>\<user> format, you simply enter the user name. Regarding how to enter the credentials, if you have an account that uses the same username and password on all machines and is an administrator
    on all of those machines, then you can enter that in the All computers credentials page of the wizard. You can also do this if they are different user names. However, if some machines have an account with the same user name, such as Administrator,
    but different passwords on each machine, you will need to use the Manually enter computer names discovery method, and then enter the information for each group or each machine.
    As you can tell, workgroup environments can quickly negate any benefit that the agentless inventory nature of MAP provides.
    Please remember to click "Mark as Answer" on the post that helps you, and to click
    "Unmark as Answer" if a marked post does not actually answer your question. Please
    VOTE as HELPFUL if the post helps you. This can be beneficial to other community members reading the thread.

  • LV7.1 Strange behavior with Automatic Error Handling occuring when it shouldn't [LV 7.1 Pro on WinXP for Tablet PC's]

    [LV 7.1 Pro on WinXP for Tablet PC's]
    I recently let a rather large LV app of mine run in the development environment while I was out for a couple of days. Upon returning I found that the app had hung for ~22 hours waiting for an answer to an Automatic Error Handling (AEH) dialog proclaiming an Error 7 in New File without any indication of the VI hierarchy that called New File.  I set about ensuring that AEH dialogs would not pop up and have not been able to discover how I could have possibly received one in the first place.
    Subsequent investigation revealed:
    Neither AEH option in Options>Block Diagrams were checked.
    Network problems had occurred around the time that the app had hung.  All file paths are network paths when running in the development environment, so the cause of the error was most likely valid, even if the AEH dialog appearance wasn't.
    My app has only one instance where the New File primitive is used by me. That subVI and all others above it in the hierarchy DO NOT have the AEH property enabled.  The error out cluster of New File in my subvi is wired.
    My app has three instances where New File is called from a vi.lib vi (Open/Create/Replace File.vi, Open Config Data.vi, and Prompt Web Browser Path.vi), none of which have the AEH property enabled.  Nor does any of their calling VI's.  All three instances also have their error out cluster wired.
    A utility to examine the AEH property of all VI's (with all top level and dynamic VI's loaded) in memory reported that only 1 of 308 vi's ( RGT Does File Exists.vi from the Report Generation Toolkit) had that property true.  That vi has no subVI's other than the File/Directory Info primitive and no calling VI's in common with any of the vi's that call New File, except a top level VI.
    As long as 'Enable automatic error handling dialogs' remains unselected in options>block diagram, I am unable to get an AEH dialog for either the New File or File/Directory Info primitives in a test VI with AEH property enabled and their error out clusters unwired no matter what invalid path I pass to the functions.  As soon as the options>block diagram>Enable AEH dialogs' is selected, both primitives fire AEH dialogs with no error out wired and don't when wired. i.e. works as advertised.
    In other words I can find no reason why I should have gotten the problem AEH dialog...
    I cannot afford for this app to hang because of a network problem, other portions of the app that were running concurrently correctly handled the error and, had the AEH dialog not appeared, the app would have made corrections or shutdown in an orderly fashion.
    Any ideas?

    Very good.
    Write Characters to File.vi>Open/Create/Replace File.vi>New File
    New File throws the error.  Open/Create/Replace strips the hierarchy from the source of the error.  Write Characters passes it to the General Error Handler.  I never looked above O/C/R file in the hierarchy except for enable automatic error handling property.  The tip-off should have been to realize that O/C/R file was stripping the hierarchy from the error and look above that. 
    The real irony is that Write Characters was being used to log error cluster data to an error log file...
    Save as... Copy without updating... the OEM 'Write Characters to File' is gone from this app.
    Thanx (a bunch)

Maybe you are looking for