[GHC] #13911: GHC RTS VEH swallowing exceptions
#13911: GHC RTS VEH swallowing exceptions --------------------------------------+---------------------------------- Reporter: tim-m89 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 Keywords: | Operating System: Windows Architecture: x86_64 (amd64) | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+---------------------------------- On ticket #6079, a top level VEH handler was implemented which effectively means there is no uncaught exceptions for those it catches. #13108 improved things a little by giving some basic info upon segfaults, but otherwise left everything as is. Rather than trying to catch all exceptions, I think it would be more worthwhile to leave them uncaught, and let current & future tools have an eyes open approach to debugging. If something needs to go in the place of the global handler, perhaps SetUnhandledExceptionFilter is of use? VEH overrides all other exception handlers as far as I'm aware (C++, SEH, .NET), so trying to interop with any other code that wants to handle it's own exceptions won't work unless said code is also using VEH. This is causing an issue for some code I've been working on, and I've documented similar to this bug report there also: https://gitlab.com/tim-m89/clr-haskell/issues/25#note_33960203 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13911> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13911: GHC RTS VEH swallowing exceptions -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * failure: Runtime crash => Incorrect result at runtime * architecture: x86_64 (amd64) => Unknown/Multiple * milestone: => 8.4.1 Comment: We do want to handle unhandled exceptions internally because of the interpreter. Code faulting during runtime linker handling leaves the application in an indeterminate state. Especially if it happened during e.g. processing of relocation. The problem with `SetUnhandledExceptionFilter` is that it replaces any existing top level filter. So it again interacts badly with your interop scenario, though maybe to a lesser extend. I think using a `VCH` instead of a `VEH` should work since those would be the last to be called instead of the first. I'll get this changed for `8.4` when I make the crash output more useful. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13911#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13911: GHC RTS VEH swallowing exceptions -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D3911 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13911#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13911: GHC RTS VEH swallowing exceptions -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1825cbdbdf08ed4bd6fd6794852596078953298a/ghc" 1825cbdb/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1825cbdbdf08ed4bd6fd6794852596078953298a" Switch VEH to VCH and allow disabling of SEH completely. Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13911#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13911: GHC RTS VEH swallowing exceptions -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"1421d87c8aabd7b1934f60bef688939882c8251c/ghc" 1421d87/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1421d87c8aabd7b1934f60bef688939882c8251c" Switch VEH to VCH and allow disabling of SEH completely. Exception handling on Windows is unfortunately a bit complicated. But essentially the VEH Handlers we currently have are running too early. This was a problem as it ran so early it also swallowed C++ exceptions and other software exceptions which the system could have very well recovered from. So instead we use a sequence of chains to for the exception handlers to run as late as possible. You really can't get any later than this. Please read the comment in the patch for more details. I'm also providing a switch to allow people to turn off the exception handling entirely. In case it does present a problem with their code. (Reverted and recommitted to fix authorship information) Test Plan: ./validate Reviewers: austin, hvr, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13911, #12110 Differential Revision: https://phabricator.haskell.org/D3911 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13911#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13911: GHC RTS VEH swallowing exceptions -------------------------------------+------------------------------------- Reporter: tim-m89 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Runtime System | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Windows | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3911 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: The double-commit was to fix erroneous authorship information. Sorry for the noise. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13911#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC