nkonev / r2dbc-migrate

R2DBC database migration library
https://nkonev.name/post/136
Apache License 2.0
99 stars 9 forks source link

Webflux based server not responding on startup after converting over to r2dbc-migrate #3

Closed RobMaskell closed 4 years ago

RobMaskell commented 4 years ago

I'm using your spring boot starter 1.0.4, with spring boot 2.3.0 Release and java 11. App was working with the same SQL in a schema.sql file that ran on startup, so db connection is ok.

Server starts up and then seems to hang and never initialises webflux to listen on 8080.

This is what I see in the logs 2020-05-26 01:14:24.208 INFO 17797 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'spring.r2dbc-org.springframework.boot.autoconfigure.r2dbc.R2dbcProperties' of type [org.springframework.boot.autoconfigure.r2dbc.R2dbcProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-05-26 01:14:24.221 INFO 17797 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'r2dbc.migrate-name.nkonev.r2dbc.migrate.autoconfigure.R2dbcMigrateAutoConfiguration$SpringBootR2dbcMigrateProperties' of type [name.nkonev.r2dbc.migrate.autoconfigure.R2dbcMigrateAutoConfiguration$SpringBootR2dbcMigrateProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2020-05-26 01:14:24.229 INFO 17797 --- [ restartedMain] n.n.r2dbc.migrate.core.R2dbcMigrate : Configured with MigrateProperties{connectionMaxRetries=500, resourcesPath='classpath:/db/migration/*.sql', chunkSize=1000, dialect=null, validationQuery='select '1' as result', validationQueryExpectedResultValue='1', validationQueryTimeout=PT5S, validationRetryDelay=PT1S, acquireLockRetryDelay=PT1S, acquireLockMaxRetries=100, fileCharset=UTF-8} 2020-05-26 01:14:24.817 INFO 17797 --- [tor-tcp-epoll-1] n.n.r2dbc.migrate.core.R2dbcMigrate : Comparing expected value '1' with provided result '1' 2020-05-26 01:14:24.825 INFO 17797 --- [tor-tcp-epoll-1] n.n.r2dbc.migrate.core.R2dbcMigrate : Successfully got result '1' of test query

nkonev commented 4 years ago

Please provide minimal example with database in docker which reproduces the problem.

There is https://github.com/nkonev/r2dbc-migrate-example with Postgres and webflux. You can make reproducing example from it.

RobMaskell commented 4 years ago

When I butcher the code to remove Okta sprint boot starter and any OAuth code, the following messages (not all for r2dbc.migrate beans)

2020-05-26 01:14:24.221 INFO 17797 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'r2dbc.migrate-name.nkonev.r2dbc.migrate.autoconfigure.R2dbcMigrateAutoConfiguration$SpringBootR2dbcMigrateProperties' of type [name.nkonev.r2dbc.migrate.autoconfigure.R2dbcMigrateAutoConfiguration$SpringBootR2dbcMigrateProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

vanish and the migration starts working. Do you make use of auto-proxying? I can't work out yet what causes those messages

RobMaskell commented 4 years ago

Possible hint here https://github.com/spring-projects/spring-boot/issues/19148 but I'm only starting here because the code works without r2dbc.migrate might not be your problem though just trying to add information because you might understand it better

RobMaskell commented 4 years ago

Problem was with bean init as I suspected, okta/oauth security needed to init the db beans for the local user store fixed it with a @lazy on the user service dependency injection but wasn't a problem before r2dbc-migrate was added I guess both racing to be initialised first for different reasons.