Closed madejejej closed 4 years ago
Merging #92 into master will increase coverage by
0.02%
. The diff coverage isn/a
.
@@ Coverage Diff @@
## master #92 +/- ##
==========================================
+ Coverage 91.58% 91.61% +0.02%
==========================================
Files 159 159
Lines 7561 7560 -1
==========================================
+ Hits 6925 6926 +1
+ Misses 636 634 -2
Impacted Files | Coverage Δ | |
---|---|---|
lib/aerospike/client.rb | 79.21% <ø> (-0.06%) |
:arrow_down: |
lib/aerospike/cluster.rb | 89.39% <0%> (+0.75%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 1ec46c0...f44ac16. Read the comment docs.
Most Ruby apps run inside threaded processes, like Sidekiq or Puma. Your code is only executed in a Worker thread spawned by the main thread. The gotcha is, if you spawn a thread with
abort_on_exception = true
and this thread raises an exception, the exception will always propagate to the main thread. This means that Sidekiq/Puma will exit due to an unexpected error.There are be at least a few cases when the Aerospike Client might raise errors in the batch commands:
This PR only fixes the batch index command, but I think it'd be great to fix patch the other places where abort_on_exception is used.
Please see the two examples below of the intricacies of abort_on_exception.
The exception will always propagate to the main thread, and sometimes also to the Thread that spawned it
Try running this code multiple times. I get different results, most probably depending on which threads gets scheduled after raising the exception.
One possible output:
Second possible output:
If more than one exception is thrown, you are not able to catch all of them, even in the main thread
This will result in a crash, for example when 2 of the nodes time out.