我正在使用spring webflux + mongodb。当一个合并多个通量的更复杂的方法返回时,我遇到了通量永远无法完成的问题(http客户端一直处于等待状态)。
在尝试复制时,似乎是以下问题:
someRepository.findAll()。subscribe([etc ...]); 尽管数据库中有15228个实体,但始终精确地发射3855个实体。无法播放完整的信号。 使用coreSubscriber时,在gc运行时将对垃圾用户进行垃圾回收,这意味着基本上没有任何东西仍在排队。
有人知道这个问题的原因和解决方法吗?
(经测试,假定在以下版本中发生100%的时间在spring-boot-starter-data-mongodb-active 2.0.0.RELEASE,2.0.3.RELEASE和2.0.4.RELEASE版本中发生两者之间的版本也一样。Mongo版本:4.0.0)
编辑:相关代码:
public interface LocationRepository extends ReactiveMongoRepository<Location, String> {}
和
locationRepository.findAll().subscribe(result -> log.info("RESULT "+result), error -> log.info("ERROR"+error),() -> log.info("DONE"));
答案 0 :(得分:1)
后来发现这是驱动程序中的死锁。可以在配置mongo时使用 AsynchronousSocketChannelStreamFactoryFactory 来解决此问题