-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
Hi.
After few days of desperate attempts to find the cause of my servers' spontaneous hangs, I managed to reproduce the issue, but still don't have a clear idea about the reason, but I think I have identified a possible direction.
All problems has started when I started using very promising operator groupBy with evicting map provider possibility:
<K, V> Flowable<GroupedFlowable<K, V>> groupBy(@NonNull Function<? super T, ? extends K> keySelector,
@NonNull Function<? super T, ? extends V> valueSelector,
boolean delayError, int bufferSize,
@NonNull Function<? super Consumer<Object>, ? extends Map<K, Object>> evictingMapFactory)
First I realised that it doesn't work well with Caffeine cache, as it performs evictions on a separate thread pool, and with async eviction notification groupBy goes crazy.
After moving to Guava things got better but only to some extent.
The tests I want to demonstrate I believe reproduce the issue I have. Definitely chain of operators is way more complicated in the production code, but here with certain variant of .publish() operator it's reproducible as well.
Basically, I'm not sure if there is issue in the groupBy(...evictingMapFactory) or in the publish(Function...), or in both.
Also tests are demonstrating that eviction policy doesn't work very well when crossing async boundaries downstream.
Please take a look at the attached file, it contains few simple tests, I kindly ask to check carefully all parameters, as it's important.