-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #813 +/- ##
==========================================
Coverage ? 64.05%
==========================================
Files ? 145
Lines ? 5003
Branches ? 0
==========================================
Hits ? 3204
Misses ? 1799
Partials ? 0
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## develop #813 +/- ##
==========================================
Coverage ? 67.56%
==========================================
Files ? 154
Lines ? 5490
Branches ? 0
==========================================
Hits ? 3709
Misses ? 1781
Partials ? 0
Continue to review full report at Codecov.
|
…ochain-rust into 2019-01-04-codecov-returns
seeing this local:
first hit on google is something about zmq, hope that's a red herring -_- |
I have some more general thoughts I'd like to share, but I'll do that in a separate comment after this. To reply to the immediate concerns here, I do feel it's very important to be able to shut things down completely, especially for testing. We're building a creature that is supposed to easily glom onto other similar creatures and start talking to them as soon as they're visible over a resilient, unenclosable network. That's exactly what we don't want for isolated tests! It seems we may already be running into some issues of lingering networks bleeding into each other, and it's only going to get worse. The two ways that tests can interfere with each other are across time (the next test starts before the last one's network stopped) and across threads. To fully remedy that interference, we need
|
As promised, here are a lot more thoughts. TL;DR, this is all stuff that I think will help us prevent more of the kinds of problems in @thedavidmeister's report, but most of it is not immediately actionable in that we could use it to fix these tests in the next few weeks.
It's true, my PR for shutdown behavior was an attempt to shut things down "pretty well", but it's hard to be confident that it's a 100% clean shutdown as soon as we introduce Cloneable references like As things get more complex that shutdown ability might get hairy to maintain. @thedavidmeister and I talked about writing lifecycle management tools eventually. As soon as things get hairy (is that now?) we might consider that.
I actually secretly spent an evening last month trying to see if I could refactor Everything I've said so far points to a strong lesson I've learned from working with Rust and other languages: when working with a strong type system, trust the type system! If something turns out to be awkward to express, or feels downright wrong (many For instance, any time we have a type that contains an With well-placed use of types we can make invalid states uncompilable and hence impossible. That's so much more powerful than just being careful that we always initialize things in the right order. The closer we can get to this ideal the more resilient the code will be, the less we'll have to rely on integration tests, and the more we'll be able to onboard new people more quickly and collaborate in general. I know a lot of code was written and established while still learning Rust, when it was hard to even get anything to compile. Maybe y'all have learned similar lessons already. I just wanted to say it explicitly even if we all know it now. This has been a bit of a rant about something seemingly tangential, but I say it to back up @thedavidmeister's point that we could stand to be more disciplined and rigorous in testing. If we're also more rigorous in our use of the type system, we can greatly reduce the number of moving parts and our tests will cover more of the actual space of possible outcomes. If we do it to the utmost, we won't have to worry about whether something is partially or fully or incorrectly initialized; if the object exists then it is good to go. Then we can focus more on unit tests and all the logic the compiler can't check.
Yes, this is the real question. Most of what I suggested is more long-term and not things we can change in the code right now. I think in the short term, I think deterministic tests are high priority, and to get those we need clean shutdown and truly independent mock networks. As far as the correctness of state initialization, we just have to be careful, and moving forward, I'd like to see more of that carefulness offloaded to the type system. |
FYI all following this thread there is some progress on the upstream segfaults: xd009642/tarpaulin#190 (comment)
|
PR to just deal with segfaults and instrumentation issues in tarpaulin at #1405 |
progress report/squirl 2019-01-07
deeper rabbit hole than expected, originally was thinking it would be a simple matter of dependency hell then pinning some versions
something that has changed recently, either in tarpaulin or in our code, is changing the way that state setup/teardown is treated
2018-12-26
0.6.11
originally we had a problem due to nightly features and transitive dependencies, which is why we disabled tarpaulin: xd009642/tarpaulin#179
the transitive deps seem to be resolved
3 new issues appeared:
instrumentation clashes
this appears to be caused by incremental compilation
RN the only solution is to disable incremental compilation, or accept the clashes
apparently the clashes aren't fatal, they indicate potentially inaccurate measurements due to LOC mappings being off, no idea how major/minor the problem might be (didn't get that far tbh)
xd009642/tarpaulin#190 (comment)
segfaults
dunno, seeking help upstream xd009642/tarpaulin#190
I hope it has nothing to do with zmq pytorch/pytorch#2507
definitely never seen segfaults in anything else i've done with rust, but here's a guide that looks helpful to debug https://jvns.ca/blog/2017/12/23/segfault-debugging/
bad context state access
this is the bit i think we need to clean up first
actually i'm not sure exactly why our regular
cargo test
runs aren't failingwhat i see is that we initialise a lot of "live" things (loops n' channels n' globals n' shit) in our tests into a "sort of" initialised state, then throw logic at them that assumes something fully initialised - these tests should fail, tarpaulin is doing the correct thing here i believe
some examples of what i mean:
Context::new
createsNone
action channels, then reducersunwrap()
action channelsthis becomes extra gnarly to debug when we throw concurrency and inability to cleanly tear down our own state into the mix (i guess cargo test is forcefully dropping our state for us "fast enough" to prevent it blowing up, while tarpaulin keeps event loops "long enough" to panic 🤷♂️ )
on circle, and locally when running
hc-tarpaulin
i can setup a live ticking network that allows the test it was intended for to pass, then see that same ticking network blow up aNone
action loop 5 tests later because the context wasn't torn down properly in the original test (or is there some global state being reused here? 🤔 ) - i tested this by creating a mock network with no-ops to the test that died on a network tickthese are pretty common problems and we identified them a while ago, but now it's blocking us for whatever reason
proposal
i'm hoping none of this is controversial... i see this as a relatively straightforward tech debt cleanup thing
real question is when/how to prioritise it considering it seems to be a requirement for getting codecov back up and running (unless we get kcov working, that is also a potential alternative but a lot more complex from an ops perspective because it relies on kcov being installed locally correctly)
NetWorker
) where every method is a no-op, so we can satisfy the compiler when we're not actively testing that trait (e.g. not testing the network)Arc
) because you can't go "the other way" to trigger a teardown for everything holding a referenceNone
without panickingunwrap
at the top ofget_entry_from_dht
is pointing to an action channel that defaults toNone
unwrap
in the codebase that is pointing to a statefulOption
should be treated with suspicion at this pointunwrap()
ing something, is it really optional?prior art