Ticket #3 (new defect)

Opened 9 years ago

Last modified 9 years ago

Crash when integral acts on single event

Reported by: wchogg Owned by: somebody
Priority: major Milestone:
Version: Keywords:


If you run the following code it will work correctly & run into the already tracked <<loop>> problem with integral. If you change the events to events' in the main function, it eats up all the RAM & causes a hard lockup. I'm not sure yet if this is related to any known bug.

import FRP.Reactive
import FRP.Reactive.LegacyAdapters?
import Control.Concurrent
import Control.Monad

x :: Event () -> Behavior Double
x e = b where b = integral e b

events :: Event ()
events = atTimes [0.1,0.2]

events' :: Event ()
events' = once events

schedule a = threadDelay 100000 >> a

main = do

c <- makeClock
u <- mkUpdater (cGetTime c) (fmap print $ x events)
forever $ schedule u

Change History

Changed 9 years ago by wchogg

An interesting thing I've noticed about this bug. When I do :break x and step through from there, I actually get to the point of printing out "0.0". When I execute main directly in ghci or via runhaskell, it locks up my terminal & eats all of my RAM.

Not sure how to proceed with diagnosis if I can't reproduce it via stepping through the code, though.

Changed 9 years ago by wchogg

Ah, I should also note that this only happens when the integral is recursive.

x :: Event () -> Behavior Double x e = integral e (pure 1)

will print out 0.0

which I'm presuming is the correct semantics for integrating a single point.

Note: See TracTickets for help on using tickets.