How to debug: w3wp.exe process was terminated due to a stack overflow (works on one machine but not another)

后端 未结 5 457
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-04 11:37

The problem
I have an ASP.NET 4.0 application that crashes with a stack overflow on one computer, but not another. It runs fine on my development enviro

5条回答
  •  遥遥无期
    2020-12-04 11:48

    One possibility for your application behaving differently in production vs development could be preprocessor directives like #if DEBUG in the code. When you deploy to production the release build would have different code segments than your debug build.

    Another option would be that your application is throwing an unrelated exception in production. And the error handling code somehow ends up in an infinite function calling loop. You may want to look for an infinite loop that has a function call to itself or another function that calls this function back. This ends up in an infinite function callig loop because of the infinite for or while loop. I apologize for going overboard with the word 'infinite'.

    It's also happened to me before when I accidentally created a property and returned the property inside my property. Like:

    public string SomeProperty { get { return SomeProperty; } }
    

    Also, if possible you could do special stuff with the exception in the Application_error function of your global.asax. Use server.getlasterror() to get the exception and log/display the stack trace. You may want to do the same for any innerexceptions or innerexceptions of innerexceptions and so on.

    You may already be doing the above mentioned things but I wanted to mention them just in case.

    Also, from your trace it looks like the error is happening in GetSortKey. Is that a function in your code? If so, then your infinite self calling may start there.

    Hope this helps.

提交回复
热议问题