Topic
  • 15 replies
  • Latest Post - ‏2013-12-26T07:50:10Z by AE91_SHINJI_KANAI
buptxch
buptxch
31 Posts

Pinned topic event lost when passing between concurrent states of one class

‏2013-12-24T03:30:39Z |

Hi, 

       i added two statecharts to one class, and when class run, an event will be send from one statechart to the other. but i find that the event (evBroadCastRecv showed in attachment) was lost.

      the two statecharts was created by adding and-line in one single state. 

      what is the problem?

Attachments

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T01:36:33Z  

    Hi buptxch,

    I can't really tell what's wrong with the execution from the image provided only, nor reproducible on my side. Can you send us a sample model? Also what makes you think evBroadCastRecv got lost, is it because the transition from "idle" to "UdpRecv" didn't take place under animation?

    Best Regards,

    --Shinji

    Updated on 2013-12-25T01:36:43Z at 2013-12-25T01:36:43Z by AE91_SHINJI_KANAI
  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T02:31:37Z  

    Hi buptxch,

    I can't really tell what's wrong with the execution from the image provided only, nor reproducible on my side. Can you send us a sample model? Also what makes you think evBroadCastRecv got lost, is it because the transition from "idle" to "UdpRecv" didn't take place under animation?

    Best Regards,

    --Shinji

    Hi SHINJI,

             there are two example i made,  first(CosiServer) runs like what i said before, and the second(testEventPassBetweenAndLine) runs normally, i can't tell what's difference between them. can you help me?

    Updated on 2013-12-25T02:34:04Z at 2013-12-25T02:34:04Z by buptxch
  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T02:33:00Z  
    • buptxch
    • ‏2013-12-25T02:31:37Z

    Hi SHINJI,

             there are two example i made,  first(CosiServer) runs like what i said before, and the second(testEventPassBetweenAndLine) runs normally, i can't tell what's difference between them. can you help me?

    rhapsody 8.0.3

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T06:59:15Z  
    • buptxch
    • ‏2013-12-25T02:31:37Z

    Hi SHINJI,

             there are two example i made,  first(CosiServer) runs like what i said before, and the second(testEventPassBetweenAndLine) runs normally, i can't tell what's difference between them. can you help me?

    Hi buptxch,

    I just looked into CosiServer.zip. The problem is that evBroadCastRecv  was fired but isn't consumed yet because the app is too busy to process null transitions occurring on the other side of "active" state; evBroadCastRecv won't be consumed until the statechart reaches to a stable state. Please read here in IC, which talks about run-to-completion semantics. Simple solution would be to limit the maximum number of null transition (e.g. setMaxNullSteps(10); ) at InfiniteLoop state. Is your question answered? Please let me know if you have additional questions. 

    Best Regards,

    --Shinji

  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T07:25:28Z  

    Hi buptxch,

    I just looked into CosiServer.zip. The problem is that evBroadCastRecv  was fired but isn't consumed yet because the app is too busy to process null transitions occurring on the other side of "active" state; evBroadCastRecv won't be consumed until the statechart reaches to a stable state. Please read here in IC, which talks about run-to-completion semantics. Simple solution would be to limit the maximum number of null transition (e.g. setMaxNullSteps(10); ) at InfiniteLoop state. Is your question answered? Please let me know if you have additional questions. 

    Best Regards,

    --Shinji

    Hi Shinji

          this is the instance statechart of the app. from this chart, you can see the event evUdpRecv is alread send out, and the other side of the active-state is stll on state InfiniteLoop. what i do in the InfiniteLoop state is just call function setMaxNullSteps(0). i think at this situation, it is able to take event evUdpRecv, but it didn't.

    Attachments

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T08:04:36Z  
    • buptxch
    • ‏2013-12-25T07:25:28Z

    Hi Shinji

          this is the instance statechart of the app. from this chart, you can see the event evUdpRecv is alread send out, and the other side of the active-state is stll on state InfiniteLoop. what i do in the InfiniteLoop state is just call function setMaxNullSteps(0). i think at this situation, it is able to take event evUdpRecv, but it didn't.

    Hi buptxch,

    Wmmm, I don't think OXF is designed to be able to take evUdpRecv in that situation. Did you have a chance to look into OMReactive::runToCompletion? In there, the real event is replaced with null event and the execution stays in the loop until max null number reaches. I believe that's the reason why your execution can't come out of loop to process the real event of evUdpRecv. Since the code is copy-right protected, I can't copy it here to discuss. Anyway, that's the best I can answer. Please feel free to share your opinion or observation, thank you.

    Best Regards, and wish you a happy Merry Xmas!

    --Shinji

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-25T23:52:53Z  

    Hi buptxch,

    Wmmm, I don't think OXF is designed to be able to take evUdpRecv in that situation. Did you have a chance to look into OMReactive::runToCompletion? In there, the real event is replaced with null event and the execution stays in the loop until max null number reaches. I believe that's the reason why your execution can't come out of loop to process the real event of evUdpRecv. Since the code is copy-right protected, I can't copy it here to discuss. Anyway, that's the best I can answer. Please feel free to share your opinion or observation, thank you.

    Best Regards, and wish you a happy Merry Xmas!

    --Shinji

    Hi buptxch,

    I studied the other model, please see the attached one I modified to simulate your issue.

    Best Regards,

    --Shinji

    Attachments

  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T03:09:00Z  

    Hi buptxch,

    I studied the other model, please see the attached one I modified to simulate your issue.

    Best Regards,

    --Shinji

    Hi Shinji,

            it did exist infinite-loop problem int rhapsody. but it can be solved by calling function setMaxNullSteps(0). In my project CosiServer.zip,  the InfiniteLoop state did not entry into a loop-state, it just call setMaxNullSteps(0) to avoid rhapsody to check infinite loop, and the loop is in the next state UdpRcv, but it did not go there yet, so why the real event was replaced by null event?

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T05:27:38Z  
    • buptxch
    • ‏2013-12-26T03:09:00Z

    Hi Shinji,

            it did exist infinite-loop problem int rhapsody. but it can be solved by calling function setMaxNullSteps(0). In my project CosiServer.zip,  the InfiniteLoop state did not entry into a loop-state, it just call setMaxNullSteps(0) to avoid rhapsody to check infinite loop, and the loop is in the next state UdpRcv, but it did not go there yet, so why the real event was replaced by null event?

    Hi buptxch,

    First, let me correct one thing. I said evBroadCastRecv  (real event) was replaced by Null event, but in fact it didn't happen just yet (I check with debugger). I totally agree with your statement on "the InfiniteLoop state ... but it did not go there yet". I believe this was caused because evUdpRecv was fired/consumed in the middle of run-to-completion, which never completes because infinite loop detection was disabled by setMaxNullSteps(0), as such it will block processing of evUdpRecv that is pending in the event queue of OMThread awaiting to be processed, it looks working-as-designed to me. Perhaps, you might add your own logic into OXF to handle this situation in a way satisfy your needs, but my suggestion is to handle it at design level. 

    Best Regards,

    --Shinji

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T05:38:38Z  

    Hi buptxch,

    First, let me correct one thing. I said evBroadCastRecv  (real event) was replaced by Null event, but in fact it didn't happen just yet (I check with debugger). I totally agree with your statement on "the InfiniteLoop state ... but it did not go there yet". I believe this was caused because evUdpRecv was fired/consumed in the middle of run-to-completion, which never completes because infinite loop detection was disabled by setMaxNullSteps(0), as such it will block processing of evUdpRecv that is pending in the event queue of OMThread awaiting to be processed, it looks working-as-designed to me. Perhaps, you might add your own logic into OXF to handle this situation in a way satisfy your needs, but my suggestion is to handle it at design level. 

    Best Regards,

    --Shinji

    Hi buptxch,

    Is there any specific reason you don't want to set none-zero value for setMaxNullSteps (default: 100)? The higher the value is, the longer the blocking time will be but this way you can ensure evBroadCastRecv gets processed out of the event queue at a certain interval, what do you think?

    Best Regards,

    --Shinji

  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T05:59:01Z  

    Hi buptxch,

    Is there any specific reason you don't want to set none-zero value for setMaxNullSteps (default: 100)? The higher the value is, the longer the blocking time will be but this way you can ensure evBroadCastRecv gets processed out of the event queue at a certain interval, what do you think?

    Best Regards,

    --Shinji

    hi shinji,   

            it was not necessary for me to call setMaxNullSteps to avoid rhapsody's checking infinite-loop. I'm just used to doing this, because it worked successly before and it it is very easy. I will try as you said.  thanks for your help. nice people.

  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T06:01:17Z  

    Hi buptxch,

    First, let me correct one thing. I said evBroadCastRecv  (real event) was replaced by Null event, but in fact it didn't happen just yet (I check with debugger). I totally agree with your statement on "the InfiniteLoop state ... but it did not go there yet". I believe this was caused because evUdpRecv was fired/consumed in the middle of run-to-completion, which never completes because infinite loop detection was disabled by setMaxNullSteps(0), as such it will block processing of evUdpRecv that is pending in the event queue of OMThread awaiting to be processed, it looks working-as-designed to me. Perhaps, you might add your own logic into OXF to handle this situation in a way satisfy your needs, but my suggestion is to handle it at design level. 

    Best Regards,

    --Shinji

    is there any way to debug in rhapsody? like insert a  break point in vc?

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T06:51:54Z  
    • buptxch
    • ‏2013-12-26T06:01:17Z

    is there any way to debug in rhapsody? like insert a  break point in vc?

    Hi buptxch,

    It's my pleasure :-) Yes, it's possible to debug Rhapsody-generated applications for C/C++ using Visual Studio.
    For the new topic, may i ask you to open up another thread? Thank you.

    Best Regards,

    --Shinji

  • buptxch
    buptxch
    31 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T07:41:17Z  

    Hi buptxch,

    It's my pleasure :-) Yes, it's possible to debug Rhapsody-generated applications for C/C++ using Visual Studio.
    For the new topic, may i ask you to open up another thread? Thank you.

    Best Regards,

    --Shinji

    Hi Shinji,

              I re-design the example, dispose the loop in UdpRecv state, and it works well, thanks for your help. I'm not quite understand about "open up another thread", should i post another topic in the forum?

  • AE91_SHINJI_KANAI
    AE91_SHINJI_KANAI
    199 Posts

    Re: event lost when passing between concurrent states of one class

    ‏2013-12-26T07:50:10Z  
    • buptxch
    • ‏2013-12-26T07:41:17Z

    Hi Shinji,

              I re-design the example, dispose the loop in UdpRecv state, and it works well, thanks for your help. I'm not quite understand about "open up another thread", should i post another topic in the forum?

    Hi butxch,

    Very good to hear that. Yes, please post another topic in this forum, it's simply because this thread is getting too long and starting a new discussion in the midst of this thread would confuse other users. Thank you.

    Best Regards,

    --Shinji