packages feed

hercules-ci-cnix-expr 0.3.4.0 → 0.3.5.0

raw patch · 4 files changed

+44/−2 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Hercules.CNix.Expr: type family NixTypeFor a :: Type;
+ Hercules.CNix.Expr: initThread :: IO ()
+ Hercules.CNix.Expr: setExtraStackOverflowHandlerToSleep :: IO ()
+ Hercules.CNix.Expr: type NixTypeFor a :: Type;

Files

CHANGELOG.md view
@@ -5,6 +5,12 @@  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## 0.3.5.0 - 2022-12-29++### Added++ - `initThread` for stack overflow handling+ ## 0.3.4.0 - 2022-11-15  ### Added
hercules-ci-cnix-expr.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.4  name:           hercules-ci-cnix-expr-version:        0.3.4.0+version:        0.3.5.0 synopsis:       Bindings for the Nix evaluator category:       Nix, CI, Testing, DevOps homepage:       https://docs.hercules-ci.com
src/Hercules/CNix/Expr.hs view
@@ -18,6 +18,8 @@     setDebug,     setGlobalOption,     setOption,+    setExtraStackOverflowHandlerToSleep,+    initThread,     logInfo,     withEvalState,     withEvalStateConduit,@@ -144,6 +146,39 @@ #endif       nix::settings.experimentalFeatures.assign(features);     } |]++initThread :: IO ()+initThread =+  void+    [C.throwBlock| void {+      nix::detectStackOverflow();+    }|]++{- | Configure the stack overflow handler to sleep before returning, allowing+  other threads to continue for a bit.++  No-op before Nix 2.12+-}+setExtraStackOverflowHandlerToSleep :: IO ()+setExtraStackOverflowHandlerToSleep =+#if NIX_IS_AT_LEAST(2,12,0)+  void+    [C.throwBlock| void {+      nix::stackOverflowHandler = [](siginfo_t *info, void *ctx) {+        Error error("stack overflow");+        logError(error.info());++        // This is risky for a signal handler.+        // Note that the original thread is now in a permanently blocked state+        // so we can easily create a deadlock.+        // Allow the rest of the process to continue for a bit.+        sleep(1);+        _exit(1);+        };+    }|]+#else+  pass+#endif  setTalkative :: IO () setTalkative =
src/Hercules/CNix/Expr/Context.hs view
@@ -31,7 +31,8 @@  context :: C.Context context =-  C.cppCtx <> C.fptrCtx+  C.cppCtx+    <> C.fptrCtx     <> C.bsCtx     <> evalContext