Fix race conditions
This PR fixes all race conditions found by -race on go test and consequently adds -race to the .circleci.
-
portnow exposesmutex.Lock/Unlock -
portcan now detect a closed channel although this can causepanicswhen forwarding a value - we nolonger leak
goroutinesafterop.Stop
Codecov Report
Merging #215 into master will increase coverage by
0.4%. The diff coverage is75%.
@@ Coverage Diff @@
## master #215 +/- ##
=========================================
+ Coverage 40.99% 41.39% +0.4%
=========================================
Files 100 100
Lines 5472 5496 +24
=========================================
+ Hits 2243 2275 +32
+ Misses 3049 3043 -6
+ Partials 180 178 -2
| Impacted Files | Coverage Δ | |
|---|---|---|
| pkg/elem/meta_store.go | 92.47% <100%> (+0.7%) |
:arrow_up: |
| pkg/elem/control_reduce.go | 100% <100%> (ø) |
:arrow_up: |
| pkg/core/operator.go | 81.98% <100%> (+1.52%) |
:arrow_up: |
| pkg/core/port.go | 71.78% <59.09%> (+1.23%) |
:arrow_up: |
| pkg/elem/control_take.go | 66.12% <0%> (+3.22%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 724413a...6cc7c31. Read the comment docs.
@jm9e Very intresting, there race isn't fixed as it now appears randomly, where https://github.com/Bitspark/slang/pull/215/commits/58773acf9f5bd03874c21bbcc0ab04dae7db645e failed, although being clean and https://github.com/Bitspark/slang/pull/215/commits/692f0a57d9234472477eaa2a2d325947c35808f5 passing. I strongly belive this has something to do with sending the ´zero value´ from the closed channel to another operator. One way of moving forwared IMO would be to introduce another marker. Another one could be to investigate why this seems to only happen to merge_sort and potentionally find the root cause.
Don't be fooled by https://github.com/Bitspark/slang/pull/215/commits/6cc7c3184a4a33b8f244ad87e969f1046bd9ce71 passing as we have seen others commits failing. It appears to me that this is a flapping test which cannot ATM be reproduced in a predictable way.
@jm9e can this be merged?