Fix deadlock bug when mkFastStringWith is duplicated
ClosedPublic

Authored by watashi on Nov 18 2018, 12:09 AM.

Details

Summary

In D5211: Rewrite FastString table in concurrent hashtable, we use withMVar to guard writes to the same segment,
this is unsafe to be duplicated. It can lead to deadlock if it is only run
partially and putMVar is not called after takeMVar.

Test Plan
./validate

We used to see deadlock when building stackage without this fix, and it
no longer happens.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
watashi created this revision.Nov 18 2018, 12:09 AM
simonmar accepted this revision.Nov 19 2018, 2:55 AM

nicecatch

I think this is a general problem with unsafeDupablePerformIO that we can't do bracket-type things inside it. I'm thinking about possible solutions.

This revision is now accepted and ready to land.Nov 19 2018, 2:55 AM
This revision was automatically updated to reflect the committed changes.