How does a global cause a race condition?

Hello All,
             I am learning about variables and realised I havent used globals and have started to investigate for a project. I am aware theres the standard global and lv2 globals, the lv2 are preferred as they dont cause a race condition. I hope I am right in thinking the race condition could be seen by opening 'System Monitor' which would indicate 100% CPU usage.
Could someone explain how the global causes a race condition and why the lv2 global doesnt cause one. Ideally a code snippet if possible please.
Many Thanks
Regards
Chris

Race conditions most often occur when multiple threads or processes are reading and writing to a single data value. Notice I said reading and writing since having a single writer will alleviate this problem. Here is an abstract example to consider:
Lets say that your bank stores your account balance in is single global called BALANCE, and both you and your spouse have an ATM card to this account.  When you use the card it calls the withdraw function (BALANCE = BALANCE - cash)  if either you or your spouse uses the card there is no problem but what if you both use it at the same time deciding to withdraw $200.00 each?
you both read the BALANCE variable which lets say is $1000.00.  You decrement your copy of the balance BALANCE = 1000 - 200 and update the variable with the new balance.  The final amount will be $800.00 but it should have been $600.00.  Ironically you might think the global saved you $200.00 but it does yield the wrong answer.  If you can avoid using globalization then avoid it.  Especially in LABVIEW where you have a data flow model of programming globals break the flow of data and can often be replaced with other data communication methods which provide a higher degree of synchronized data flow like queues.  If you are seeing nondeterministic results (looks random) this is a sign that you have uninitialized variables (rare in Labview) or you have a race condition.  Hope this example helped some,
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA

Similar Messages

  • WLST 92 - How to Create Global Role and Role Condition?

    I'm currently using WLS 9.2 and trying to use WLST to create a global role and defining a role condition. Anyone know how to do so using WLST for WLS 9.2?
    Trying to:
    - create Global Role, testRole
    - create condition where 'username = testuser'
    thanks!

    Did you find out a solution for this?

  • How does a global variable affect the runtime of optimisation-function fminsearch?

    Hi,
    my function "fmintest" needs 254s ~ 4min to finish calculation in Mathscript, while Matlab needs
    3s!!! I need the sorfware for data processing in a real time measuring system, where the calculation have to be done within 5 seconds.
    In the Mathscript-help I found the following (global -> details):
    If you call this function from a MathScript Node, LabVIEW operates with slower
    run-time performance for the MathScript Node. To optimize the performance of the
    MathScript Node, remove this function from scripts.
    How can I remove needed global variables in the fminsearch function handle? Is the system faster if I would/can remove the global variables?
    How can I avoid Mathscript-breakdown after saving changes to m-files and restarting them again?
    regards
    Attachments:
    ni3.7z ‏2 KB

    Hi,
    can you provid a VI and not only your m-files? It will be easier to help you!
    Can the customer provide a VI that demonstrates this behavior, rather than just providing the m files?
    Also, the Help file says fminsearch is not supported by the
    LabVIEW Run Time engine, so please take that in mind. If you want to build an application you cant use this function.
    Regards, RMathews

  • How does the Global Data Plan affect my limits while still in the states?

      I turned on the Global Data Plan for a trip next week.  Will my normal data limits apply while still in the states this week?

        Hi KBKB,
    I wish you a safe trip next week. The Global Data Plan has no impact on the data plan you would use in the states because they cover data differently at a separate cost and data allowance. Do you need more details on our Global Data plan? Visit http://vz.to/1oEXUCa.
    Thank you! EdW_VZW
    Follow us on twitter @VZWSupport

  • Is a functional global with loops inside case structure subject to race condition?

    Such as this one:
    Solved!
    Go to Solution.

    bmihura wrote:
    I'm being a bit dense here... would somebody write an example VI that demonstrates how functional global variables eliminate race conditions whereas a normal global variable would not? Or just describe it and I'll write the VI?
    The classic example used is a bank account.  Say you are making a deposit.  You have to read the current balance, add the deposit amount, and save the balance.  Now say you are making a withdrawal.  You have to read the current balance, subtract the withdrawal amount, and save the new balance.  Now let us say that both of these events happen at the same time.
    If you are using global variables, you read the global, perform the action, and save to the global.  But who reads what balance.  If both events read the balance at the same time, then whoever writes last will overwrite the other's action.  This is bad, especially if your deposit "didn't happen".
    Now using a FGV (or Action Engine), you can contain the critial parts of the code.  In this case the critical parts are the full read, act, and write.  So with the AE, you store the balance in a shift register.  You can perform whatever action you want inside of the AE VI.  Because the AE is not reentrant, only 1 action can be performed at a time.  So you make sure that deposit happens and is not overwritten by the withdrawal.
    Now for my caveat.  If all you do is a Get and Set inside of the FGV, it is basically a global variable, just slower.
    Read that acticle I linked to earlier and also read up on the Action Engine nugget.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • 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. 

  • EJB New User Create Race Condition

    If I have an EJB that creates a new user account that does the following in the method:
    if username already exists then
    send error message to user
    else
    proceed with new user creation
    end if
    How do I prevent the following race condition:
    User1 EJB: user name does not exist
    User2 EJB: user name does not exist
    User1 EJB: create new user
    User2 EJB: create new user
    Thanks,
    Kurzweil4

    unfortunately, you don't. however, assuming you have a unique constraint in the database, you can do this, but it's tricky because you might not get the failure until the transaction is committed. i personally would handle this by having the "main" (remote) method call untransacted. make this method call a second local ejb with a transaction context of create-new. do the actual work within this second method call. when this second method returns, either the call succeeded, or you will get some sort of ejb transaction rollback exception. you can then handle this exception in the outer method call.

  • 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]

  • How does client connect to RAC

    I'm confused how client connect to RAC,
    1) According to this:
    http://www.datadirect.com/developer/odbc/odbc_oracle_rac/connecting/index.ssp
    "a ServiceName exists for the entire Oracle RAC system. When an application uses the Oracle RAC system's ServiceName, the Oracle RAC system appears to be a single Oracle instance to the application"
    so, seems client just make sure using service name instead of SID, it will be connect to RAC. the URL format is same as single non-RAC enviroment
    2) however,according to this:
    http://forums.sun.com/thread.jspa?threadID=5274308
    The URL need to be:
    jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
    (ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
    (ADDRESS=(PROTOCOL=TCP)(HOST=host2) (PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME=service)))
    this make RAC connect URL differenct from single non-RAC enviroment
    if so, with this format, how does SQL developer connection set up? since you can only specify one host in connection properties configuration?
    if so, adding a node will require all of client modify connect url?
    3) my understanding is client only need to specify VIP to any one of node, and speicify global service name (all node should share same service name), this will make RAC connection setup (similar to above (1)), but I'm not sure if my understanding correct or not in the following senario:
    -- a) what if client using public ip (not VIP) to one of node, but using global service name?
    -- b) what if client using VIP to one of node, but using it's SID instead of global service name?
    -- c) what if client using public ip (not VIP) to one of node, and using it's SID?
    please clarify how does client connect to RAC?
    Thank you!

    Very good question.
    You have asked in a certain way which tells me you have done lot of research.
    Any how:-
    Remember no matter how convoluting it looks it is the same.
    1 Tns Entry
    If you add a node then yes you have to publish it.
    There are other alternatives such as Oracle Names [old]
    internect directory , ldap and so on, beyond the scope of this discussion.
    1)
    TNSNAME Entry
    RAC.WORLD=
    DESCRIPTION=DESCRIPTION=(LOAD_BALANCE=on)
    (ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
    (ADDRESS=(PROTOCOL=TCP)(HOST=host2) (PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME=service))
    Now see The same string from DESCRIPTION onwards goes to jdb thin client, it
    is the same thing...
    Also the host1 host2 are all VIPS'
    Also you need failover , load balance thingies in there
    -- a) what if client using public ip (not VIP) to one of node, but using global service name?
    non vip, Test it out, tns should hop over it .
    but TAF /FAN won't work.
    -- b) what if client using VIP to one of node, but using it's SID instead of global service name?
    You have to use SERVICENAME, if you are using SID then you are pretty
    much connecting to 1 node.
    -- c) what if client using public ip (not VIP) to one of node, and using it's SID?
    Then you are using 1 node rac.

  • 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.

  • How does condition category affect the price procedure

    Hello Gurus,
         there is a case as following:
    if the condition type in the pricing analysis says in a billing document that the ‘‘condition is found and set,” and one is using the condition requirement number 024 (which only determines the price in billing document) yet still has to do new pricing in order to obtain the condition record, Should the condition category be blank, the system would propose the message “condition is found and set” but does not provide an actual condition record.
       the fault would be that the condition category on the condition type should be equal to L.
       so my question is " how does condition category affect the price procedure" ? thanks very much!

    Hi Zhang,
    -->Condition category is a classification of conditions according to predefined criteria.
    -->These categories include packaging costs, delivery costs, output taxes and discounts.
    -->The classification of conditions by condition categories can be used for analysis.
    I hope it will clear for you
    Regards,
    Murali.

  • How does a RAC DB 'spread' from single instance to multiple instances ?

    GI/RDBMS Version: 11.2.0.3
    OS: Oracle Linux 6.3
    Filesystem : ASM
    When a RAC database is created using dbca , Manually , or RMAN restore, the DB is created in the Node1 first with cluster_Database=FALSE .
    Then you run the following commands (for 3-node RAC)  from Node1
    srvctl add database -d lmnprod -o $ORACLE_HOME -p +LMNPROD_DATA01/lmnprod/spfilelmnprod.ora
    srvctl add instance -d lmnprod -i lmnprod1 -n hwcarser290
    srvctl add instance -d lmnprod -i lmnprod2 -n hwcarser291
    srvctl add instance -d lmnprod -i lmnprod3 -n hwcarser292
    Once the DB is created,mounted and opened in Node1 and the above commands are executed , you set cluster_Database=TRUE and startup the Instance2 and Instance 3 in Node2 and Node3.
    I just want to know how does Node2 and Node3 becomes aware of the DB and joins the DB cluster ? What happens internally ?

    Generally speaking, registering in OCR is not required for database to be a cluster database.
    Migration from single-instance database to cluster consists of creating redo logs and undo tablespace for new instance and enabling this instance (thread). If database is policy-managed, this is done automatically for new node.

  • Campaign Automation – Periodic Campaign. How does it work properly?

    Hey guys,
    I would like to start a period campaign (once per week over 52 weeks). Depending on the survey answers I get back from business partners, I would like to create weekly new target groups (where I want to collect the business partners in 3 groups: partners who answered yes, partners who answered no and partners who did not react to the survey), a new telephone list (with communication channel u201CFile Exportu201D  for partner who answered no) and u201CThank-youu201D (for partner who answered yes)-as well as u201CReminderu201D(for partner who did not react at all)-emails. 
    Unfortunately the realization does not work as I hoped. After my second period started only the survey email will be send out again, but the target groups are not getting updated anymore and the jobs (after the business partners send back their answers) do not get triggered so no new target groups, telephone lists or emails are getting generated after the first period.
    Here my questions:
    u2022     Why does, after my second period started (automatically), only the send out of the survey email works but no connection jobs get triggered after the answer are coming into the system, as sending out the u201EThank-Youu201C Mail, update of target groups or generation of the telephone list? Which of my setting could be wrong? How does the set-up of the campaign automation need to look like so that this will work?
    u2022     To my knowledge, generated target groups from the first period need to be emptied again automatically (or at least be set back to the old condition) before the second (third, fourth, fifth etc.) period starts, so that this one can be executed correctly (e.g. partners who answered yes in the second period can be collected correctly this time without getting mixed up with partners who said yes in the first period). How can this be accomplished? Is there a Badi for this? Anything else?
    u2022     In case there is really a way, that I can set target groups to the u201Coldu201D condition, where can I see e.g. the generated telephone lists or target groups from previous periods? Where does information like this get saved? In the campaign automation itself only the last information can be found and old information probably get overridden with the next periods information so where do I find the information from previous periods? Because I am pretty sure that you would like to be able to control who e.g. did not react to the campaign six periods before or which business partners said yes 10 periods before.
    It would be awesome if anyone could give me some answers or information where I might get answers to that problem or how I need to set up my campaign so that my requirements can get implemented.
    Thank you very much in advance!
    Janine
    Edited by: Janine P. on Nov 24, 2011 11:05 AM

    Hi Sapan,
    this is what SAP answered me:
    "As per my understanding, this requirement could work, but this might
    cause Human errors, thus creating issues for your functionality.
    Ideally, the Periodic campaigns are meant for multiwaves itself, but
    the Target Group is the same in all the waves. However, if you wish to
    change the Target Group during the Campaign Period, then this could
    cause manual errors, thus leading to disruption of the normal flow and
    thus the Campaign itself.
    Also, since the process would anyway involve manual intervention for
    changing the Target Group, you could also Copy the already existing
    Periodic Campaign and create a new one having the newly created Target
    Group.It would take hardly 5 min extra and the naming conventions would
    help you in maintainence or reporting at a later stage as well.
    For Example:
    1st week : Periodic_Campaign_1 and Target_Group_1
    2nd week : Periodic_Campaign_2 and Target_Group_2
    52nd week : Periodic_Campaign_52 and Target_Group_52
    Therefore, I would suggest you to go ahead with this approach.
    However, if you still wish to try out the single Campaign for the full
    year(52 weeks), I would suggest you to try out an example campaign with
    the below inputs:
    1. Create the Marketing Attribute questions and assign them to the BP's.
    2. Create a Profile which holds these Marketing Attributes.
    3. In the Periodic Campaign, use the Workflow 'Create TG and Channel
    Transfer'. This would create the Target Group using this profile and
    also send mails to this Target Group.
    4. Make changes to the Profile parameters during the campaign sleep
    period(after the 1st execution is over and before the 2nd execution,
    and so on)
    You can test for Period type 'hours'/'days' using such a campaign and
    test if it works correctly as per your requirement. "
    Hope this helps.
    Kind regards,
    Janine

  • RT jitter! Can multiple reads to a variable / cluster cause a blocking condition?

    Howdy do.
    While incrementally developing and testing an application on a crio9068 (linux RT)  I've begun to see the 'finished late?' indicator in my main timed loop flicker. Starting to pull my hair out trying to figure out how to prevent this from happening. I made a 'hold max' vi and can see the longest execution time for each frame.
    The application runs fine at about 75% processor load with the front panel open, and the majority of iterations execute in time. Occasionally, I'll have a 'spike' in execution time, and all four frames in the timed loop take significantly longer than normal to execute, and the 'late' indicator says so.
    A couple questions I've had build up while chasing this:
    -If I use local varables to pass data between loops, but only write to the variable in one place, can I still cause a blocking condition/jitter by competing reads of that memory space?
    -If I use an FPGA read/write node to pass data between the timed loop and the FPGA, should I expect this to cause a problem? I selectively disabled a lot of my code, and it seems like this is where some of the delay occurs. What stumps me is that these parts of the code haven't changed in recent development and the thing never used to run late.
    -On the topic of the FPGA read/write node, I previously assumed that I shouldn't write to the same FPGA FP item in different subvis. However, the code is set up so that there are multiple parallel calls to the read/write node, just with different elements selected. Is this BAD?
    -Similarly, if I unbundle and read the same element from a cluster control in a 'parallel' fashion, can this cause a blocking situation, or is it the same as unbundling and wiring from there to multple places?
    -I am using the recently renamed "NI software calibration and management toolkit (SCM)," formerly Drivven CalView, to handle communication between the RT and a windows host. It also does neat fault management stuff. Anybody else using this, and is there any possibility I'm getting jitter by having too many calpoints in my deterministic loop?
    Any guidance on any of the above points would be greatly appreciated. If I don't make sense on any of the above points I can make example snippets to describe.
    Solved!
    Go to Solution.

    Tom,
    Thanks for your input(s). I'll stop obsessing over the local variables and the branched cluster wires for now.
    I didn't realize that all the code in the timed loop would be serialized beyond normal execution. In fact, this brings up another question I have. Somewhere I read that the overhead of multithreading would cause an issue. Since the 9068 has two cores, I had previously been setting the CPU selector in the timed loop to 'automatic', which seemed to load both cores roughly equally. Doesn't this mean that the process is being multithreaded? Funny thing is that even when I do select cpu 0 or cpu 1, they both are roughly equal in utilization while the timed loop is running.
    The period for the timed loop is set at 15ms, and the execution of all the frames usually occurs in less than 10ms. After several seconds I'll get a 'spike' in execution time, and it will take 20-30ms to complete an iteration. I'm not positive if my benchmark is valid, but if I look at the execution time for each frame and 'hold' the maximum time, it seems like they all (four frames) take extra time at this one instance. So that hasn't helped to narrow it down much. 
    It sounds like you have a method in mind for 'caching runtime data'. If you can point me in a good direction to gather more information about what the thing is doing it would help. I have run a strip chart of execution times, attached.
    How much should I expect having the front panel open will affect the determinism of the loop? I realized it added overhead, but since the overall CPU load is less than 60% (each) with all the bells and whistles (other loops) disabled, I thought it wouldn't be having an effect like this.
    Again, thanks for throwing ideas around, it really helps.
    Matt
    Attachments:
    iteration execution.png ‏16 KB

  • 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

Maybe you are looking for

  • How to make the words show up without me prompting by tapping space bar?

    Now that I have gotten all the text on the front page to appearall together and not one line at a time, each line prompted by me hitting the Space bar, how do I get the words to appear all on their own without me tapping the space bar? This will be e

  • How to create Checkerboard Iris transition in Final Cut?

    Hi, I was looking for a iris video transition that starts from multiple points in a checkerboard pattern. I don't see one in FCE. Does anybody know if one is available from a third party vendor. Thanks a lot, j Message was edited by: jeffd55

  • Many online stores not working due to the new update.

    Hi, Mavericks has been awesome so far, except a number of problems, iBooks store will not run, i click on the store button then the app goes unresponsive and only leads to a force quit and then same problem if i open the app again. Next problem is ve

  • Hash partition algorithm

    If I hash partition a table on CUSTOMER_ID into say p partitions. I receive a daily batch feed of flat file transaction records that contain CUSTOMER ID. I need to split the batch of incoming source records into p parts and each part should correspon

  • ITunes Suddenly Won't Recognize Music Files

    I have synced my iPod with my Toshiba laptop more times than I can count. When I opened iTunes this morning, iTunes did not show any of my music/podcasts, etc. After a moment of panic, I realized that everything was still on my computer and in my iPo