none
.Net 4.5 framework issues in wcf (System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame) RRS feed

  • Question

  • Team,

    We have an interesting scenario. I have written a WCF which runs as a windows service. This WCF uses MSMQIntegration binding and listens the queue and process the message. This has been developed using VS2013 with .Net 4.5 as target framework. We are deploying the same in windows server 2012 and that machine also has the .Net 4.5 framework installed. Interminnently, we are getting the below error which stops the service abruptly.

    Framework Version: v4.0.30319
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.Runtime.CallbackException
    Stack:
       at System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame(UInt32, UInt32, System.Threading.NativeOverlapped*)
       at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

    After going through some of the links which says to change the framework version in the app.config

    http://weblog.west-wind.com/posts/2012/Mar/13/NET-45-is-an-inplace-replacement-for-NET-40

    i have changed the app.config like 

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0"
                          sku=".NETFramework,Version=v4.5" />
      </startup>
    </configuration>

    After this also the service is stopping abruptly. Can anyone throw some light on this? Is it an issue which is happening randomly with the framework 4.5 or is it some thing like things can be controlled using configuration. It will be really helpful if some one clarifies me the same properly.

    Regards,

    Ram



    Regards,
    Funshuk

    Wednesday, July 16, 2014 10:49 AM

Answers

  • Hi Folks,

    Finally we broke the ice. The thing is if an operation initiated by the WCF call takes some amount of time, the transaction is getting closed resulting in the start of the next transaction. In this case the message in the queue. The same message has been picked even before the first transaction has been completed, because for the .Net framework the transaction ends at giving the authority to one more web service. To explain clearly, A is a wcf service which listens in Queue 'abc' and the messages are processed by a method ProcessMessage(); Inside this A calls B which is a third party web service, which in turn access some DB and get the data back. For the .Net, the transaction ends once it calls the B. But internally B may take more time in getting the Data, so the total call times out and the WCF starts another transaction with the same message. Now B will be updating the data twice as the first one acknowledgement went unnoticed. 

    To solve this, we made sure all the timeouts are set to a maximum of 10 minutes and also transaction timeout property of the service was also set to 10 mins. This solved the issue as there was enough time to respond back to the caller and calling systems.

    Thanks,

    Ram


    Regards,
    Funshuk

    • Marked as answer by rprasad79 Monday, October 13, 2014 8:56 AM
    Monday, October 13, 2014 8:56 AM

All replies

  • Hi Funshuk,

    I found a hotfix to this problem, please refer to the following link to see more information. http://support.microsoft.com/kb/2531867/en-us. Please try it and let me know the result.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. &lt;br/&gt; Click &lt;a href=&quot;http://support.microsoft.com/common/survey.aspx?showpage=1&amp;scid=sw%3Ben%3B3559&amp;theme=tech&quot;&gt; HERE&lt;/a&gt; to participate the survey.

    Thursday, July 17, 2014 3:03 AM
  • Hi Wong,

    Thanks for the reply. I am not able to reach that link. I guess the link is broken or it is not available. Can you kindly direct me the right link.



    Regards,
    Funshuk

    Thursday, July 17, 2014 7:17 AM
  • Hi Funshuk,

    The link is alive. I test it on my side. Please check your network on computer.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. &lt;br/&gt; Click &lt;a href=&quot;http://support.microsoft.com/common/survey.aspx?showpage=1&amp;scid=sw%3Ben%3B3559&amp;theme=tech&quot;&gt; HERE&lt;/a&gt; to participate the survey.

    Thursday, July 17, 2014 7:23 AM
  • Thanks Wong. I have one clarification here, whether the fix is applicable only for .Net 4.0 or is it the same fix for .Net 4.5 framework. I guess this has to hold good as runtime is same for .Net 4.0 and .Net 4.5


    Regards,
    Funshuk

    Thursday, July 17, 2014 11:38 AM
  • Hi Wong,

    We got the hotfix, but unfortunately, we are not able to install it. When we try to install it says, there are some components which are already installed which takes care of the hotfix.

    Also i checked the hotfix details and it says it will be applicable only for windows server 2008 r2. We are using windows server 2012.

    I also see this error system.callbackexception in event vwr, after the transaction getting completed. So i strongly suspect the framework is not finishing the thread and failing.

    Regards,

    Ram


    Regards,
    Funshuk

    Monday, July 28, 2014 10:04 AM
  • Hi Folks,

    Finally we broke the ice. The thing is if an operation initiated by the WCF call takes some amount of time, the transaction is getting closed resulting in the start of the next transaction. In this case the message in the queue. The same message has been picked even before the first transaction has been completed, because for the .Net framework the transaction ends at giving the authority to one more web service. To explain clearly, A is a wcf service which listens in Queue 'abc' and the messages are processed by a method ProcessMessage(); Inside this A calls B which is a third party web service, which in turn access some DB and get the data back. For the .Net, the transaction ends once it calls the B. But internally B may take more time in getting the Data, so the total call times out and the WCF starts another transaction with the same message. Now B will be updating the data twice as the first one acknowledgement went unnoticed. 

    To solve this, we made sure all the timeouts are set to a maximum of 10 minutes and also transaction timeout property of the service was also set to 10 mins. This solved the issue as there was enough time to respond back to the caller and calling systems.

    Thanks,

    Ram


    Regards,
    Funshuk

    • Marked as answer by rprasad79 Monday, October 13, 2014 8:56 AM
    Monday, October 13, 2014 8:56 AM