Ticket #926 (new bug)

Opened 2 years ago

Last modified 2 years ago

infinite loop in ShutdownIOManager()

Reported by: guest Assigned to: simonmar
Priority: lowest Milestone: _|_
Component: Runtime System Version: 6.5
Severity: normal Keywords:
Cc: mark@eeter.fi.tartu.ee Difficulty: Unknown
Test Case: Architecture: x86
Operating System: Windows

Description

Hi,

I have found a way to 'hang' a DLL created using ghc-6.5.20061006 under Win32. This occurs when I dynamically load DLL built using GHC, call one of its exported functions that uses file IO and then exit my program without explicitly releasing the DLL first. I have uploaded a test application to http://eeter.fi.tartu.ee/~mark/ghc_hang.zip that demonstrates this issue.

I am not sure if I can call this a bug, as when I unload the DLL, everything works fine. But this does not happen in GHC-6.4.2 or older versions.

Regards, Mark

Attachments

ghc_hang.zip (2.0 kB) - added by igloo on 10/09/06 17:29:48.
Just attaching the submitter's testcase to the bug report

Change History

10/09/06 17:29:48 changed by igloo

  • attachment ghc_hang.zip added.

Just attaching the submitter's testcase to the bug report

01/26/07 11:16:57 changed by igloo

  • testcase changed.
  • milestone set to 6.6.1.

02/01/07 03:35:19 changed by simonmar

  • owner set to simonmar.

I'm looking at this.

02/01/07 03:58:29 changed by simonmar

  • priority changed from normal to lowest.
  • milestone changed from 6.6.1 to _|_.

Fixed in the threaded RTS:

Thu Feb  1 03:40:47 PST 2007  Simon Marlow <simonmar@microsoft.com>
  * Partial fix for #926
  It seems that when a program exits with open DLLs on Windows, the
  system attempts to shut down the DLLs, but it also terminates (some
  of?) the running threads.  The RTS isn't prepared for threads to die
  unexpectedly, so it sits around waiting for its workers to finish.
  This bites in two places: ShutdownIOManager() in the the unthreaded
  RTS, and shutdownCapability() in the threaded RTS.  So far I've
  modified the latter to notice when worker threads have died
  unexpectedly and continue shutting down.  It seems a bit trickier to
  fix the unthreaded RTS, so for now the workaround for #926 is to use
  the threaded RTS.

I'll leave the bug open, but at a low priority since there are good workarounds.