locked
Size causes error: An unhandled exception ('System.StackOverflowException') occurred in w3wp.exe RRS feed

  • Question

  • User-761949169 posted

    I have created a web running on Windows 2003 Server with IIS6 that has a function to Export data returned from a search.  When the results create an Excel spreadsheet of about 159KB or less, the operation works without any problem and returns a spreadsheet with the data from the search.

    Once the size of the Excel file is larger, the W3WP.EXE process crashes.  One of those crashes reported the following error: An unhandled exception ('<System.StackOverflowException>') occurred in w3wp.exe -- See below for the 2 events recorded when it crashes.

    The web site uses the Entity Framework for managing the access to the SQL 2005 Server where the data is stored.  The search results are gathered in an ObjectQuery which is loaded into a DataTable.  The DataTable is then processed using OpenXML SDK 2.0 procedures to create the Excel spreadsheet returned when a user clicks the Export button.

    First of all, I cannot determine why it is crashing when the search results are too big (in other words, why is the size of the file being created causing W3WP.EXE to crash from a Stack Overflow Exception), but ultimately I just want to try and find a way to configure the web server to handle requests of this size.

    Event Type: Error
    Event Source: VsJITDebugger
    Event Category: None
    Event ID: 4096
    Date: 7/19/2012
    Time: 12:06:15 PM
    User: NT AUTHORITY\NETWORK SERVICE
    Computer: CRPRDNIISSIE
    Description:
    An unhandled exception ('<System.StackOverflowException>') occurred in w3wp.exe [42024]. Just-In-Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on.

    Check the documentation index for 'Just-in-time debugging, errors' for more information.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    Data:
    0000: 02 00 5c 80 ..\€

    Event Type: Warning
    Event Source: W3SVC
    Event Category: None
    Event ID: 1011
    Date: 7/19/2012
    Time: 12:06:15 PM
    User: N/A
    Computer: CRPRDNIISSIE
    Description:
    A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the World Wide Web Publishing Service. The process id was '42024'. The data field contains the error number.

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    Data:
    0000: 6d 00 07 80 m..€

    Thanks for any help that can be provided on how to resovle this issue ... Dean

    Wednesday, July 18, 2012 7:29 PM

Answers

  • User-761949169 posted

    I was fortunate that one time out of about 30 failures, an Event log entry showed up for w3wp.exe itself indicating a Stack Overflow.

    The problem turned out to be in how the Entity SQL handles a large EXISTS IN list, so the Stack Overflow was caused by the Entity Framework when the list had between about 850 to 900 items.

    I used an alternate way instead of the EXISTS IN and it resolved my problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 19, 2012 4:11 PM

All replies

  • User-1716253493 posted

    Did you export from sqldatasource or gridview?

    Wednesday, July 18, 2012 8:26 PM
  • User-761949169 posted

    I revised my original post to describe how the results are gathered into an Entity Framework ObjectQuery which is then converted into a DataTable and processed by OpenXML SDK 2.0 procedures to create the Excel spreadsheet.

    Please note this question has been revised to try and find out why W3WP.EXE is crashing because of a Stack Overflow Exception when the size of the results (an Excel spreadsheet) are more than 159KB.

    Wednesday, July 18, 2012 8:40 PM
  • User-761949169 posted

    I was fortunate that one time out of about 30 failures, an Event log entry showed up for w3wp.exe itself indicating a Stack Overflow.

    The problem turned out to be in how the Entity SQL handles a large EXISTS IN list, so the Stack Overflow was caused by the Entity Framework when the list had between about 850 to 900 items.

    I used an alternate way instead of the EXISTS IN and it resolved my problem.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 19, 2012 4:11 PM