Git Product home page Git Product logo

Comments (7)

mp911de avatar mp911de commented on May 23, 2024 1

See also reactor/reactor-core#1486.

from spring-data-r2dbc.

mp911de avatar mp911de commented on May 23, 2024 1

That's fixed now.

from spring-data-r2dbc.

ToffeeLu avatar ToffeeLu commented on May 23, 2024

One thing to correct is this IllegalStateException happens only after commenting the code of Mono.error(new RuntimeException("6")), which means it doesn't work when no error happens.

from spring-data-r2dbc.

mp911de avatar mp911de commented on May 23, 2024

I wasn't able to reproduce the issue (see reproducer code. Can you provide a complete, minimal, verifiable sample that reproduces the problem, ideally as GitHub repository or Gist?

from spring-data-r2dbc.

ToffeeLu avatar ToffeeLu commented on May 23, 2024

@mp911de check this reproducer code
Just as I said above, error only happens without Mono.error(),
here is what's different between me and your reproduce code:

    LegoSet legoSet1 = new LegoSet(null, "SCHAUFELRADBAGGER", 12);
    LegoSet legoSet2 = new LegoSet(null, "SCHAUFELRADBAGGER", 13);

    Flux<Map<String, Object>> transactional = client.inTransaction(db ->
      legoSetRepository.save(legoSet1)
          .then(legoSetRepository.save(legoSet2))
          .then(Mono.empty()));

and the error - Caused by: java.lang.IllegalStateException: Connection is closed! happens:

java.lang.AssertionError: expectation "expectError(Class)" failed (expected error of type: MyException; actual type: java.lang.RuntimeException: Async resource cleanup failed after onComplete)

	at reactor.test.ErrorFormatter.assertionError(ErrorFormatter.java:105)
	at reactor.test.ErrorFormatter.failPrefix(ErrorFormatter.java:94)
	at reactor.test.ErrorFormatter.fail(ErrorFormatter.java:64)
	at reactor.test.ErrorFormatter.failOptional(ErrorFormatter.java:79)
	at reactor.test.DefaultStepVerifierBuilder.lambda$expectError$6(DefaultStepVerifierBuilder.java:357)
	at reactor.test.DefaultStepVerifierBuilder$SignalEvent.test(DefaultStepVerifierBuilder.java:2112)
	at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onSignal(DefaultStepVerifierBuilder.java:1408)
	at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onExpectation(DefaultStepVerifierBuilder.java:1356)
	at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onError(DefaultStepVerifierBuilder.java:1030)
	at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onError(FluxContextStart.java:117)
	at reactor.core.publisher.FluxUsingWhen$UsingWhenSubscriber.deferredError(FluxUsingWhen.java:397)
	at reactor.core.publisher.FluxUsingWhen$CommitInner.onError(FluxUsingWhen.java:520)
	...
	at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:310)
	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:141)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:583)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:500)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
	at java.lang.Thread.run(Thread.java:748)
	Suppressed: java.lang.RuntimeException: Async resource cleanup failed after onComplete
		at reactor.core.publisher.FluxUsingWhen$CommitInner.onError(FluxUsingWhen.java:519)
		... 129 more
	Caused by: java.lang.IllegalStateException: Connection is closed!
		at org.springframework.data.r2dbc.function.connectionfactory.SingletonConnectionFactory.create(SingletonConnectionFactory.java:54)
		at org.springframework.data.r2dbc.function.DefaultTransactionalDatabaseClient.lambda$cleanup$7(DefaultTransactionalDatabaseClient.java:142)
		at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118)
		... 128 more


Process finished with exit code -1

from spring-data-r2dbc.

mp911de avatar mp911de commented on May 23, 2024

Thanks a lot, I'll have a look.

from spring-data-r2dbc.

mp911de avatar mp911de commented on May 23, 2024

The initial trace results in unexpected behavior of our resource cleanup. The cleanup happens twice and that's why the refCounter in the bound connection factory is decremented twice. This results in prematurely closing the connection. Analysis ongoing.

from spring-data-r2dbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.