What happens with ASP.Net thread after Response.End ThreadAbortException?

落爺英雄遲暮 提交于 2019-12-07 15:52:15

问题


There are a few  answers explaining Is Response.End() considered harmful?  However I haven't find a clear confirmation, what would happen with ASP.Net thread after Response.End ThreadAbortException.

Eric Lippert  in his comment to Response.End () doesn't abort current thread  noted  that "thread is just going to go back in the thread pool.", but he admitted, that he had  not worked on the threading model for more than 10 years.

In CodeProject article Exploration of approaches to handle ThreadAbortException with Response.Redirect it was told that  "the current thread (which is taking care of the current Request) should be terminated (and go back to the Thread Pool),", but later it was  mentioned that the ASP.NET worker process could face thread starvation. 

 Can someone  provide any references to clarify  will the thread

  • be returned to the pool, or
  • terminated and removed from the pool?

There is similar (not Asp.net specific) unanswered question Aborting a thread-pool thread

BTW, there is a popular beleive that ThreadAbortException can be caught by application code, but is re-thrown at the end of the catch block(sourced from MSDN  Thread.Abort Method ). However it is not correct (at least it is not always correct). I found the code in our application, that after Response.End caught and "eat" ThreadAbortException, and  processing is continued without any re-throw.

.

来源:https://stackoverflow.com/questions/16878724/what-happens-with-asp-net-thread-after-response-end-threadabortexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!