-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NonDet handler throws storage assertion #255
Comments
We're upgrading from 1f1f351, if that helps! |
Can you give me the code of your handler? |
I'm not sure which bit you want? We're not handling |
Right. That's what I get for reading stuff on my phone 😅 Is this the same place #243 throws in? You mentioned there that the bug disappeared when you switched to NonDetKeep, but this is NonDetRollback. Did you switch back? |
FWIW I think it's the same thing as #243, just manifesting earlier due to the new sanity check. |
Btw, are you using |
Nope, we don't use either (well, we have one use of |
No, it's in a different place where apparently I decided to use |
Btw, the call stack from the first message is relatively useless because it ends inside the call to Is this problem at least reliably reproducible for you now that the new sanity check is in place? If so, I'd like to see the surrounding code of the offending call site. Generally speaking I need to see something. I need a reproducer, doesn't have to be small, because so far me playing a playing a guessing game unfortunately hasn't got us anywhere near the solution. I'd like to get to the bottom of this because I find this problem concerning, but I can't do much if you don't show me any code. |
That's totally fair, as usual I thought it was worth putting up what we have now in case it happened to tickle your brain into figuring it out :) I'll investigate more. |
Ok, I think I got a reproducer. I did this: diff --git a/effectful-core/src/Effectful/Internal/Monad.hs b/effectful-core/src/Effectful/Internal/Monad.hs
index 1ac5f79..d1822bb 100644
--- a/effectful-core/src/Effectful/Internal/Monad.hs
+++ b/effectful-core/src/Effectful/Internal/Monad.hs
@@ -553,6 +553,8 @@ send
-> Eff es a
send op = unsafeEff $ \es -> do
Handler handlerEs handler <- getEnv es
+ when (envStorage handlerEs /= envStorage es) $ do
+ error "wtf"
-- Prevent internal functions that rebind the effect handler from polluting
-- its call stack by freezing it. Note that functions 'interpret',
-- 'reinterpret', 'interpose' and 'impose' need to thaw it so that useful And I'm getting wtfs in NonDet/OnEmptyRollback tests. I'll have a look tomorrow. |
Can you check #256? It should fix this. |
Confirmed that this fixes it! |
@arybczak Do you plan to release a minor version with this bug fix, or should we just run with |
You can run with HEAD for a moment, I plan to merge the overhaul of |
I don't have a small reproducer, but when trying to upgrade to 2.4 we see this error. It doesn't look like it's anything to do with our code, but rather something to do with
NonDet
. The unlifting function in question is created inside the handler ofNonDet
, and is then only called within that handler. But there is some shennanigans with backing up and restoring environments, perhaps that can trigger this?The text was updated successfully, but these errors were encountered: