Getting this exception "copyAndReset must return a zero value copy"

When I am executing my spark program I am getting the following exception:

java.lang.AssertionError: assertion failed: copyAndReset must return a zero value copy

Accumulator<Integer> count = sc.accumulator(0);