withTrace sometimes fails to close the trace
deepfire opened this issue · 2 comments
deepfire commented
There is some evidence that in certain cases withTrace
may fail to run its closing side:
https://github.com/input-output-hk/iohk-monitoring-framework/blob/master/iohk-monitoring/src/Cardano/BM/Setup.lhs#L75
This is evident in the routing tests -- as modified by 323da4a -- the closing side is never called:
Closing side:
323da4a#diff-994d687fdff98f853d46887653be7953R147
Output:
Routing tests
Unit tests
default_scribe_must_log: setSetupScribes
withTrace
within Trace
without Trace -> readFile
FAIL
Exception: out-test.txt: openFile: resource busy (file is locked)
set_backend_must_log: setSetupScribes
withTrace
error while opening log: out-test.txt
exception: out-test.txt: openFile: resource busy (file is locked)
within Trace
without Trace -> readFile
setSetupScribes
withTrace
FAIL
Exception: out-test.txt: openFile: resource busy (file is locked)
set_scribe_must_log: error while opening log: out-test.txt
exception: out-test.txt: openFile: resource busy (file is locked)
within Trace
without Trace -> readFile
setSetupScribes
withTrace
FAIL
Exception: out-test.txt: openFile: resource busy (file is locked)
set_scribe_with_wrong_filename_must_not_log: error while opening log: out-test.txt
exception: out-test.txt: openFile: resource busy (file is locked)
within Trace
without Trace -> readFile
setSetupScribes
withTrace
FAIL
Exception: out-test.txt: openFile: resource busy (file is locked)
no_scribe_must_not_log: error while opening log: out-test.txt
exception: out-test.txt: openFile: resource busy (file is locked)
within Trace
without Trace -> readFile
FAIL
Exception: out-test.txt: openFile: resource busy (file is locked)
Testing Structured Logging
The modified test with traces is at https://github.com/input-output-hk/iohk-monitoring-framework/blob/489-withTrace-infelicity-repro/iohk-monitoring/test/Cardano/BM/Test/Routing.lhs#L129