cloudfoundry-community / firehose-to-syslog

Send firehose events from Cloud Foundry to syslog.
MIT License
44 stars 58 forks source link

Byte slices are only valid WITHIN the bolt transactation. #191

Closed aeijdenberg closed 6 years ago

aeijdenberg commented 6 years ago

See "Caveats" in bolt doc: https://godoc.org/github.com/boltdb/bolt#hdr-Caveats

This commit refactors to ensure that the value slice is not used after the transaction.

(by the way, I'm just fixing this as a drive-by while trying to debug what may or may not be a related issue - I'm not sure if this is the culprit yet - I just recognized the pattern as a mistake that I've made in other projects, so thought I'd clean it up as I went - the behaviour of using a slice outside a transaction is not defined, so there's a decent chance this is causing the cache to not operate as expected)

shinji62 commented 6 years ago

Oh I guess I miss this part. But Did you see any errors?

aeijdenberg commented 6 years ago

@shinji62 - I haven't explicitly seen errors in this context yet (I'm about to do some testing on it).

I have seen this exact same pattern reliably cause errors and all around unpredictability on other projects that I've worked on in the past.