Dr. Damien's Developmen​t - Debugging Race Conditions

Awhile back, one of the forum posters suggested I share some of the techniques I have developed in my years as a LabVIEW programmer.  This is the first in an occassional series.  Race condition debugging is the topic of the day, since it was the topic which prompted the suggestion.
Anyone who has programmed LabVIEW for any period of time has probably run into a race condition.  You used a global variable when you shouldn't.  That local that used to be a simple scalar morphed into a cluster and then starting blapping your control booleans.  You copied a cluster and didn't reinitialize it correctly.  There are lots of ways to do it.  But how to do you find it?
Race conditions often rely on an exact timing and execution sequence.   A good clue that you have a race condition is that your code works correctly when you step through it with execution highlighting.  You need a way to see what is happening in real time.  I do this by sprinkling my code with the small VI attached below (LabVIEW 7.1 version, Windows only).  This VI writes strings to the debug device every time it is run.  These strings can be read by anything which will read the debug device, but the easiest way to watch them is using DebugView from the Microsoft SysInternals suite of applications.  DebugView gives you timestamps with processor tick count precision, so you can accurately determine exactly when the code runs (Note that Linux and Mac users can get much the same functionality by writing a string to stderr.  Since I have not actually done this, I cannot give details of use.).
Where do you put these function calls?  If you have no clue where the problem is, start with your top level loop.  Make sure you put identifying tags at each location.  Include the values of the variables you are trying to find race conditions in.  This should allow you to find the problem spots.  At this point, start placing more tags in a sort of binary search for the problem.  Experience has shown that you can usually find a race condition in under an hour using this technique, provided you can reproduce the race condition in the first place (which may be a real problem).
If you are using LabVIEW 8.0 or better, you can put a conditional compile structure around the error debugging code and leave it in your code so you don't have to remake it every time.
There are probably as many methods of debugging race conditions as there are LabVIEW programmers.  How do you do it?
This account is no longer active. Contact ShadesOfGray for current posts and information.
Attachments:
WinDebugLogging.vi ‏33 KB

Logging when things happen is a great way to start to track down race conditions. For logging purposes I use a queue-based logging system. There is a separate log viewer that's essentially a window with a string indicator with a built-in search mechanism, but there is also an option to dump it to file. As with the previous solution, it's cross-platform. 
Unfortunately, logging on its own is not enough to be able to track down race condition caused by local variable abuse since there is no data dependency.  There is no way to know whether the access of the local happened before or after the logging event. In this respect there is little that LabVIEW programmers can do other than to artifically create a data dependency which essentially removes the race condition that you were trying to track down in the first place. Given this, it would be great if LabVIEW had a built-in mechanism for logging read/write access to locals and globals, which in most cases are the primary causes of race conditions.
By the way, is "blapping" a technical term?  I will let the reader look up that term. 

Similar Messages

  • Problems debugging multiple threads to test race conditions

    I was trying to use JDeveloper 10.1.3 to debug race conditions (in the Embedded OCJ4 Container) and was not able to get the degree of control over multiple threads that I had hoped. I was able to trap a break point where I see two active request threads in the Threads window, and I am able to select each thread individually and see the current line of code that each is currently on. However, if I use the debugger controls to step a line of execution on one of the threads, the execution point also seems to change on the other thread.
    In some other IDEs I have used concepts like "freezing" and "thawing" threads which provide fine grain control over debugging race conditions. Is anyone aware of a similar concept in JDeveloper that I might just not be aware of? Instead it just seems that debugger has either paused the JVM or else plays all threads while only bounding particular thread you have focus on to the number of execution steps you specified (step into, step over, step out of, ...).
    Thanks.

    There are some developers that have mentioned this to me also.
    It appears to be possible in eclipse however, but not JDeveloper. Can anyone verify this, and hopefully give us a work around?
    Thanks,
    Tony

  • Custom Tag in race condition with OC4J v9.0.2.0.0...

    Hello all,
    (I tried deploying my application with OC4J 9.0.3 but none of my existing
    tags worked)
    I developed a OC4J web application implementing my own tag library extension
    and found out that there was occurring a race condition to the fact that two
    users (different sessions) where accessing the same
    tag at the same time. In the offending tag implementation I only have
    instance members and not static which could also cause a
    concurrent access problem.
    I found that OC4J was reusing concurrently the same
    Tag instance when it should not do that!!!
    public class pagesIteratorTag extends BodyTagSupport {
    // only instance class members...
    public void doInitBody() throws JspException {
    System.out.println("pageSetIteratorTag::doInitBody - Tag instance value: " + this.toString() + " for user: " + this.pageContext.getSession().getAttribute("j_username"));
    public int doAfterBody() throws JspException {           
    System.out.println("pageSetIteratorTag::doAfterBody - Tag instance value: " + this.toString() + " for user: " + this.pageContext.getSession().getAttribute("j_username"));
    Note the pagesIteratorTag@2e same instance is used when it should not
    1 because the tag instance should be protected from multiple concurrent
    access even though it can be pooled and reused if it is free.
    pageSetIteratorTag::doInitBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Frank
    pageSetIteratorTag::doAfterBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Frank
    pageSetIteratorTag::doInitBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    pageSetIteratorTag::doAfterBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    pageSetIteratorTag::doInitBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    pageSetIteratorTag::doAfterBody - Tag instance value: com.kdlabs.fogal.tagext.pagesIteratorTag@2e for user: Giovanni
    Session for user Frank throws a null pointer exception because Giovanni's session
    started accessing the variable.
    Can anyone advise please?
    Best Regards,
    Giovanni

    First of all, you said none of your tags worked in 9.0.3. What happened? Did you do any debugging of the problem?
    Comparing the "toString()" output of your tag does not guarantee they are the same instance. That is just the output of "hashcode()", not the "pointer" to the object. The hashcode is generated from the contents of the object, not its "identity".
    I suggest you track the NPE in the debugger and get more information before you assume the container is at fault (which is still an outside possibility). SDK API Javadoc
    Object class:
    The general contract of hashCode is:
    1-. Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
    So, the toString() is properly returning the suffix of the object instance
    number unique for that instance and is then being reused by OC4J even though
    it is being accessed from another session thread, that must not happen and it
    is not compliant with the JSP spec.
    The other history is that when I implemented my custom tags OC4J was JSP 1.1 compliant
    and not 1.2, so after moving to 1.2 the scripting variables can be defined in XML and
    by subclassing TagInfo class, the last option doesn't work with OC4J 9.0.3, not good...
    Thanks for your help,
    I will keep trying to figure out what the problem migth be,
    Best Regards,
    Giovanni

  • Race conditions - can you actually lose the data in memory?

    I've seen posts where a race condition can actually destroy the contents of a global memory. I understand about not getting the right information if your read just beats your write, but can it actually lose the data altogether? This would mean you have to semaphore every time you write to a global if you have something polling on it to guarantee the data doesn't get lost. I've never seen this in any example programs - its hard to believe!

    I think the idea is merely that when you write to a global (or any)
    variable the previous contents are overwritten. If you intended to read the
    global before the write but the write ends up happening first then you lose.
    "mikema111" wrote in message
    news:[email protected]..
    > I've seen posts where a race condition can actually destroy the
    > contents of a global memory. I understand about not getting the right
    > information if your read just beats your write, but can it actually
    > lose the data altogether? This would mean you have to semaphore every
    > time you write to a global if you have something polling on it to
    > guarantee the data doesn't get lost. I've never seen this in any
    > example programs - its hard to be
    lieve!

  • How to prevent race conditions in a web application?

    Consider an e-commerce site, where Alice and Bob are both editing the product listings. Alice is improving descriptions, while Bob is updating prices. They start editing the Acme Wonder Widget at the same time. Bob finishes first and saves the product with
    the new price. Alice takes a bit longer to update the description, and when she finishes, she saves the product with her new description. Unfortunately, she also overwrites the price with the old price, which was not intended.
    In my experience, these issues are extremely common in web apps. Some software (e.g. wiki software) does have protection against this - usually the second save fails with "the page was updated while you were editing". But most web sites do not
    have this protection.
    It's worth noting that the controller methods are thread-safe in themselves. Usually they use database transactions, which make them safe in the sense that if Alice and Bob try to save at the precise same moment, it won't cause corruption. The race condition
    arises from Alice or Bob having stale data in their browser.
    How can we prevent such race conditions? In particular, I'd like to know:
    What techniques can be used? e.g. tracking the time of last change. What are the pros and cons of each.
    What is a helpful user experience?
    What frameworks have this protection built in?

    Hi,
    >> Consider an e-commerce site, where Alice and Bob are both editing the product listings. Alice is improving descriptions, while Bob is updating
    prices. They start editing the Acme Wonder Widget at the same time. Bob finishes first and saves the product with the new price. Alice takes a bit longer to update the description, and when she finishes, she saves the product with her new description. Unfortunately,
    she also overwrites the price with the old price, which was not intended.
    This is a classic question that you can find in any developing exam :-)
    there are several options according the behavior that fit your needs, and several points that need to be taken into consideration.
    1.  Using locking in the application side, you can make sure that two people do not open the same product for editing. this is in most cases the best option.
    * I am not talking about
    thread-safe but the implementation is almost the same. The locking can be done using singleton class and have a static boolean element. Every time a user want to edit we check this value as first action. If the value is false then we lock the and
    change it to true -> do what ever we need -> change the value to false -> unlock.
    Behavior: First person that try to edit lock the product and the second get a message that this product is unders editing. In this case you do not open connection to database and your application prevent any problem.
    2. Using "read your writes", as mentioned
    Behavior: this mean that several people can open the same product for editing, and only when they try to send it to server they get a message telling them that they have waist their
    time and someone else already change the product information. At this point they have two option: (1) overwrite what the other person did, (2) start from the beginning.
    This is the way most WIKI websites work.
    3. Using real-time web functionality like SignalR, WebSocket, or any streaming for example. In this case you can send the person that work on the edit a message like "this product have already been edit" and stop give him the extra time to
    think what you want to do. You will need to use one of the above option maybe, but since the user get the information in real time he have time to chose.
    4. Using "Change before Write" or "read before edit": The idea is to have a column that point if the row is in use. the type of this column should be same as the user unique column type. Before the user start you check the value
    of this column. If it is 0 then you change it to the user unique value (for example user_id), If the value was not 0 then you know that someone else is editing the product. In this case the locking is managed in the database. make sure that you work with transactions
    while reading the value and changing it! you can change the default from share lock to X lock as well during this action, if you really want.
    There are several other option, if those do not fits your needs
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • 8.1.2 "Could not launch" message: race condition at startup

    (apologies for the cross-post; someone suggested that I post this in the Unix forum, so here it is -- I suppose it would have made sense to do this in the first place, I mustn't have been concentrating :-)
    Hi,
    I've recently upgraded our Sun Ray servers to Adobe Reader 8.1.2, and now every so often when browsing to a pdf document, Firefox says
    "Could not launch Adobe Reader 8.1.2. Please make sure it exists in your PATH [...]"
    This seems to be caused by a race condition at startup. The browser plugin runs "/bin/acroread -version", which simply echoes the version number and exits. When it's working, this happens:
    25436: write(1, " 8 . 1 . 2\n", 6) = 6
    25348/1: read(56, " 8 . 1 . 2\n", 20) = 6
    25436: _exit(0)
    25348/1: close(56) = 0
    i.e. the string is written by the script and immediately read by the browser.
    However, occasionally this happens:
    23119: write(1, " 8 . 1 . 2\n", 6) = 6
    23119: _exit(0)
    23008/1: Received signal #18, SIGCLD, in read() [caught]
    23008/1: siginfo: SIGCLD CLD_EXITED pid=23119 status=0x0000
    23008/1: read(58, 0xFFBFB5C0, 20) Err#4 EINTR
    i.e. the read() call is interrupted by the SIGCLD generated by the exiting /bin/acroread process.
    I've inserted a "sleep 5" after line 11 of the /bin/acroread script to try to alleviate this, but I haven't tested it fully.

    Hello Ian,
    Thanks for reporting this. We will try to address this issue in the next release as you have stated a valid race condition issue (though it's difficult to reproduce).
    Gaurav

  • Array Of Clusters Not Initializing or Possible Race Conditions

    Hi all,
    I've been working on a fairly complex project for work, and I haven't worked with Labview before. Unfortunately nobody in my office really has experience with it so I'm on my own. I've mostly got the project working, and it might be a little cumbersome, but if it works that's fine.
    Essentially it's a temperature control device and I made it so it's expandable, thus the clusters and arrays everywhere.
    My question is this. I've got an array of clusters indicating the status of all the plates in the system. When I start up the VI for the first time they do not initialize. They just stay grey, but when I stop it and start it once, it will work every time. I think this is kind of strange behavior. I've heard of race conditions and while I've tried to make sure t hat's not happening, it might be without me noticing.
    I've tried putting an initialize array block in the first call while loop and that doesn't do anything, and if I remove the initializer from the shift register in the top while loop that stops them being initalized altogether.
    I guess I was hoping someone might have an idea what's causing it, or could possible give my code the once over. The main bulk of it is in the very top of the code, but there are a lot of smaller events taking care of GUI type stuff.
    I've included all source code. It might be a little much but I didn't want to start pulling it apart if I don't know what's happening.
    Thanks in advance.
    Chris.
    Solved!
    Go to Solution.
    Attachments:
    Error During Cycle Controls.zip ‏3107 KB
    Stop Cycle Controls.zip ‏2115 KB
    Stop Cycle Controls.zip ‏4975 KB

    Chris Johnson wrote:
    So just to confirm, I can have one event structure with say 10 events happening? In this case could an event happen simultaneously with another? I thought I read something about each event having it's own event structure and while loop to make sure this works out.
    Each event case must complete before it can handle the next event, but many events will complete so quickly that this is not an issue (such as your "pause chart" button).  In general you should have only one event loop.  If you expect an event to take a long time to process, use a queue to hand that task off to another dedicated-purpose loop, so that the event structure can go back to waiting.  This is one example of the producer-consumer structure often mentioned on this forum: the producer is the loop containing the event structure, and it queues (produces) items to process.  A separate loop dequeues (consumes) those items and handles them appropriately.
    As GerdW mentioned, you have race conditions all over the place.  You'll never know whether the Plate Info Cluster Array is properly updated because it's being written and read simultaneously in so many places.  I'm assuming that is also where you're seeing the issue that inspired the post, and, in fact, one of those race conditions could explain what you're seeing.
    Chris Johnson wrote:
    Also, again, to confirm what I think I already know. When the event completes it outputs whatever data you output from the structure and then you can place it in a shift register. Where does this go until the next event takes place?
    I don't understand what you're asking.  Where does what go until the next event?  If by this you mean the data in the shift register - it stays in the shift register, accessible at the corresponding terminal on the left side of the loop.

  • Race condition?? javax.faces.el.PropertyNotFoundException: Error testing pr

    Hi All,
    I created a SelectOneChoice using data control (via a Session Facade) on a page. It works fine. (say includePage.jspx)
    Then I try to include this page into other pages say mainPage.jspx (after change the tag from view to subview in includePage.jspx). I need to do this include because multiple pages will include this page.
    Now when I try to run mainPage.jspx, I have the following exception:
    javax.faces.el.PropertyNotFoundException: Error testing property 'inputValue' >>>in bean of type nullThe bean in this exception message is referring to something defined in the includePage.jspx page def file, but I am running mainPage.jspx - so I am wondering if this is a sort of race condition, i.e when mainPage.jspx is ruuning, no variables inside includePage.jspx page def can be accessed.
    I searched the forum but did not have much luck. Any suggestions will be greatly appreciated!!!

    Hi,
    any binding used on a subview must be included in the binding of the main page. So your mainPage.jspx must include the binding for the listbox.
    In 10.1.3 there is no option to inherit the binding container content of an included page.
    Frank

  • Dr. Damien's Developmen​t - The Xylophone Project X - Font Issues and Front Panel Layout

    The Show Raw Data button was made active in this installment. Doing this in a robust fashion was more involved than one might think, due to font and platform issues (remember I want to port this to a Windows Mobile device eventually). The following changes were made.
    The A frequency indicator was made active. This was an oversight from the last update.
    A front panel object, XylophoneFP.lvclass, was created to hold the front panel references and methods.
    The front panel object was used to implement the Show Raw Data button.
    The front panel object was used to compensate for font issues.
    When testing this application on Windows Vista, I noticed that the font differences between Vista and XP were annoying enough that I wanted to fix them. This will also lay the groundwork for any layout issues when porting to Windows Mobile. Usually, I create a cluster containing all my front panel references, but this time I put them into an object. Besides the usual object boilerplate, there are two methods, one to rearrange the front panel and one to show/hide the data graphs.
    Once the controls and indicators are properly arranged, showing and hiding the data graphs is simple. VI server methods are used to find the edges of the outer controls, some whitespace is added, then the front panel size is reset. Arranging the controls in the first place is much more complex. Dialog controls are used, and these controls change size based on the default font size. Font sizes can change due to user preference or when using the application in a different operating system than it was developed in. Button sizes can also change due to localization.
    This problem is difficult to solve cleanly, and the VI which does this, XylFP.lvlib:XylophoneFP.lvclass:ArrangeControls.vi, shows the problem. It relies on the actual sizes of the controls/indicators to rearrange the front panel in a hopefully pleasing fashion. Even though this is a relatively simple UI, the VI is fairly complex. It uses VI server calls to determine the current sizes of controls and then rearrange them. If you choose to do something similar, consider the following hints:
    The Bounds property of all controls is not writable. To change the size of controls, you need to find the property or properties which change the size. There may be more than one (which is why Bounds is not writable). For example, to change the size of a boolean, use the Button Size property.
    In many cases, the property you use to change the size of the control will not be the same value as the Bounds property. Using the boolean again, the Bounds of a 3D LED include the 3D effect around the LED, but the Button Size only includes the LED itself. Comparing the Bounds property to the result of a query to the property you will be setting will give you the necessary offset to convert between the two.
    Make sure you label your wires if you attempt to do things like this. Long wires are very common in this type of programming. It is difficult enough to keep track of things without the added aggravation of having the trace wires back to their source to identify them.
    A few judiciously placed type converters can eliminate many type conversion dots. This is not usually a real problem in this context, but you should get into the habit of efficient programming.
    I will be hiking through the mountains of New Mexico with the Boy Scouts for the next couple of weeks, so do not be dismayed if I do not reply to comments very quickly. However, comments and suggestions are still welcome and encouraged. I will reply when I return.
    Previous Installments
    Data Acquisition Concept
    GUI Concepts
    Specifications
    Core Architecture
    Data Acquisition and Note Analysis
    Sound Acquisition Revisited
    Sound Analysis
    Configuration Dialog
    Calibration Dialog
    Message Edited by DFGray on 06-05-2009 03:09 PM
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    XylophoneX.zip ‏1259 KB

    DFGray wrote:
    I put the event structure in the command loop so that events are processed synchronously.  In the past, I have run into a variety of race condition/synchronization issues when separating the event and command loops and prefer to keep them together to make the program structure simpler.
    It is simpler but you give up any multi CPU performance.  That LV is inherently parallel is one (the only) real advantage over a text based development system.  I can write good structured text that is almost as visually easy to parse as LV.  With modern syntax coloring engines, the difference in icons vs. structured text is not that great.
    But the challenge I give the traditional text coders is to keep track of many mulitple threads.  This is why dataflow is a powerful concept.  Yes it does lead to asynchronous execution but if you impose synchronicity on your code you are working against LV.  I get most first time programs where everything is in a sequence structure.  "Just to be safe".  
    Of course this is much better but  my first design goal is that any application should take advantage of a much hardware as possible, degrade gracefully on slower hardware and play nice with other running applications.  This simpler structure severely handicaps that first goal.
    In this case it is simple enough to "get away" with it since as you point out that there should not be anything that takes significant CPU time.   But that may not be true on the PDA?
    If you are going to run it on the PDA will we be discussing techniques to seamlessly use both NIDAQmx Base and NIDAQmx in the same system?  That is a real challenge.  I look forward to more of this!
    Cheers! 

  • What is dead locks with oracle and wht is race condition wrt oracle

    what is dead locks with oracle and wht is race condition wrt oracle

    > And do you know what a race condition is all about?
    It is a term used to indicate several processes attempting to use the same resource that is not capable of servicing all these at the same time. This could be due to the resource not being thread safe or implemented as a serialised resource.
    It is often easy to look up definitions on Google. In the Google search field, type "define:race condition".
    The following [url http://www.google.co.za/search?hl=en&q=define%3Arace+condition&btnG=Google+Search&meta=]web definitions page is displayed.

  • Problems w/ race conditions when using attachmovie

    Hello,
       I'm having a strange problem w/ race conditions when using attachmovie.
    I have a class linked to a movie clip that I'm attaching to the stage.   The class is
    fired off when the movie clip is attached but also other classes are getting loaded at the same time
    while the movie clips is attached.     Even though the other classes are called after the
    movieclip is attached, they are getting loaded faster and therefor the class linked to the attached movie clip
    cannot access their functions. 
    I'm looking for a listener that will fire off an event ONLY when the attached movieclip is fully loaded but I can't
    seem to find any examples of associating a listener to a attachmovie method.
    Any ideas?
    Thanks,
    Clem C

    flash is single threaded so nothing happens simultaneously.  what do you mean by, "other classes are getting loaded at the same timewhile the movie clips is attached"

  • Race conditions with UI thread

    Hi community,
    the update to LabVIEW 2014 has caused sveral of my vis to act up - vis that I had coded with race conditions with the UI thread that I was not aware of.
    Maybe they didn't exist previously, maybe I was just ignorant.
    Here is a where I first noticed something was wrong. It has a workaround inside:
    http://forums.ni.com/t5/LabVIEW/How-to-make-sure-plots-in-xy-graph-are-present/td-p/3033109
    Thanks again Norbert for your help with that.
    Now problems are showing up in other places too and it might be the tip of an iceberg. I'm a little afraid right now. It's not just xy graphs. The latest example:
    I have a sub-vi whose frontpanel I open with an invoke node inside that sub-vi. Afterwards, in the caller I register for events of frontpanel objects of the sub-vi. This fails now - apparently the fp of the sub-vi isn't open yet although the sub-vi has finished executing (yes, I use dataflow to ensure register for event is done only after the sub-vi has finished). This has a striking resemblance to my issue in the previous thread. It seems that vis can now be "finished" executing while stuff that was supposed to happen inside the sub-vi is still executing in the UI thread.
    I had not expected this.
    Is this intended behaviour?
    Is this new to LabVIEW 2014?
    Can someone please shed some light on this behavior change (if indeed it is one)?
    Can someone please advise me on a general solution/workaround for the host of problems this is causing me?
    Best regards
    Florian

    Norbert,
    I'm currently unable to reproduce the issue in my code regardless of cpu core affinity (you gotta hate random errors).
    I have attached an example that shows a simplified version of the code that has previously produced the error.
    This example might be flawed since it hasn't produced the error yet.
    The issue would show when the button "open window" is pressed, if it did at all.
    Also there is stuff in there that I just implemented in an attempt to keep the UI thread busy.
    For the core of the issue please disregard the bottom while loop in caller.vi
    I'll keep trying.
    Best regards
    Florian
    Attachments:
    subvi event registration.llb ‏56 KB

  • Forms 6 CPU racing (not race condition)

    Hello Everybody,
    I am having a strange problem that I was not able to find anything about in the other posings. Hoping somebody can point me to some helpful info or posings.
    Here is what is going on:
    I have Oracle 8i installed on an Intel P4 testing platform along with Forms 6.0.5. The machine is equiped with enough memory and power that Forms and Oracle 8i should be able to run without any trouble (I have run this setup fine on less powerful machines).
    When I then run a Forms application in the new setup the Forms application starts up normally and appears to be running perfectly.
    However when I look at the Windows Task Manager the Forms application turns out to be racing the processor at 100% of capacity. Even some little tiny forms application with only one Canvas and 2 blocks still causes the CPU to race at 100% capacity - even when I am not running a query! It just sits there and revs the CPU.
    Even stranger when I put the input focus onto any other program (NotePad for instance) the CPU cycles die back to zero again. But when I again put the focus (using ALT-TAB or something) back onto the Forms application the CPU starts revving up again.
    Note that this is NOT a "race condition" because I am still able to use the computer and even the Forms application itself. However it is NOT normal for a little tiny Forms module to be able to take up 100% of CPU cycles even when the module is not doing anything.
    Anybody have any ideas what the problem could be?
    Thanks for any help.
    Chris

    Chris,
    if it doesn't hang the computer as it indicates then maybe the task manager does not show what's really consumed by Forms. Ig Forms 6.0 is the cause then I suggest to upgrade to Forms 6i as this is tested and bug fixed with newer OS and processors.
    Frank

  • How to solve this race condition

    Hi there,
    the following code was taken from an official Java Tutorial at http://java.sun.com/docs/books/tutorial/essential/threads/synchronization.html but it's bugy 'cause it's creating race conditions I cannot handle.
    // this is the consumer
    // it tries to get the content of cubbyhole
    // but as soon as "available" becomes "false"
    // the content can change
    public synchronized int get() {
            while (available == false) {
                try {
                    wait();
                } catch (InterruptedException e) { }
            available = false; // <-- the producer can access the cubbyhole
            notifyAll(); // the producer is being notified (wake up)
            return contents;
        }Imagine the scheduler interrupts the consumer just after the "notifyAll()" method (race condition). The producer can access the cubbyhole (available = false) and store a new value in it. Due to the fact that the cubbyhole is a reference the "return contents" command in the consumer will now return the new (overwritten) value. This code definitely won't work. The only way it works is to clone (!) the current "contents" in a separate variable BEFORE awaking the producer and enabling it to make changes.
    I had serious troubles in using the wait() methods and like to know your oppinions/experiences about that.
    Thx for reading.
    90210

    I'm not going to bother looking at that tutorial, but I'd venture to guess that you are making a false assumption. Since get() is synchronized, no other thread can acquire a lock to the object being synchronized on while this method is changing the value of 'available' to false. But without seeing the context of what those other threads might be doing, it's hard to tell if you really have a valid claim or not (that it's 'buggy'). But 99.99999% of the time, its your own mistake/misinformation/invalid analysis.

  • [svn:bz-trunk] 21111: Bug: BLZ-578 - [Coverity] potential race condition for class flex.messaging.MessageBroker

    Revision: 21111
    Revision: 21111
    Author:   [email protected]
    Date:     2011-04-21 06:12:37 -0700 (Thu, 21 Apr 2011)
    Log Message:
    Bug: BLZ-578 - potential race condition for class flex.messaging.MessageBroker
    QA: Yes
    Doc: No
    Details: The bug was fixed by change 19598 already, but also adding a minor fix to not call setSystemSettings in initThreadLocal method becuase there are no thread local variables in MessageBroker anymore.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-578
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/MessageBroker.java

Maybe you are looking for