getEvent can't deserialize event serialized by putEvent
- Dominant language
- Haskell
- Stars
- 37
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
ghc-events currently fails to deserialize some events that it serializes. To reproduce, first generate a minimal eventlog file from the program `main = return ()` (tried GHC 8.4), then run
```haskell
import Data.Binary.Get
import Data.Binary.Put
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import GHC.RTS.Events
import GHC.RTS.Events.Binary
import GHC.RTS.Events.Incremental
main = do
bs <- LBS.readFile "empty.eventlog"
let header = runGet getHeader bs
let parsers = mkEventParsers header
let event = Event
{ evTime = 415731793
, evSpec = GCStatsGHC
{ heapCapset = 0
, gen = 1
, copied = 305104
, slop = 250088
, frag = 3088384
, parNThreads = 12
, parMaxCopied = 4246
, parTotCopied = 305104
}
, evCap = Nothing
}
print (runGet (getEvent parsers) (runPut (putEvent event)))
```
Output:
```
bug: Data.Binary.Get.runGet at position 60: not enough bytes
CallStack (from HasCallStack):
error, called at libraries/binary/src/Data/Binary/Get.hs:351:5 in binary-0.8.5.1:Data.Binary.Get
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with GHC.RTS.Events.Binary's getEvent and putEvent, using the provided reproduction with mkEventParsers and the minimal eventlog generated from `main = return ()`. Confirm the runGet/runPut round trip failure and trace the serialized GCStatsGHC fields; done means events produced by putEvent deserialize successfully with getEvent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100