These are chat archives for spring-cloud/spring-cloud

10th
Jul 2017
dragontree101
@dragontree101
Jul 10 2017 05:50
@kakawait thanks very much
Israel Fernández
@iferca
Jul 10 2017 10:53
Im implementing some background jobs as spring cloud tasks triggered from spring data flow, I was having some weird behavior where the task seems to get eventually stuck and stop processing data. My task runs inside a command runner invoking a bean that process data using a reactive flow, so it returns immediately and spring will start disposing the context. Theoretically the task continue running because that reactive flow is actually processing data but I noticed that behavior were it get stuck. I tried by turning that program into a service with spring-boot-web and it will run fine.
Not sure if is the task or the reactive stream processing to blame. Does anyone have had similar experience before?
Dave Syer
@dsyer
Jul 10 2017 10:55
If the application context closes it will try to stop thread pools and clean up the JVM
You should probably try and keep it alive until the work is finished
But without seeing the code it's hard to say more than that
You said "spring will start disposing the context" but that only happens when the JVM exits AFAIK, unless you did something explicit.
Israel Fernández
@iferca
Jul 10 2017 10:59
I said that because I have a lifecycle notification bean in slack and I see "shutting down" notification as soon as the spring context creation completes. That is a poor man implementation, is just a @predestroy method posting on slack
Dave Syer
@dsyer
Jul 10 2017 11:01
I guess the JVM is shutting down then.
Israel Fernández
@iferca
Jul 10 2017 11:01
I think that since the creation of the flux returns immediately spring assumed the command finished and start destroying the rest of the beans
Dave Syer
@dsyer
Jul 10 2017 11:01
You should probably prevent that
It's probably easiest if your CommandLineRunner just blocks and waits to finish
It's a bit of a smell that it doesn't do that already.
You must have told it to work in the background
Israel Fernández
@iferca
Jul 10 2017 11:03
Hum... Ok not sure how do that will look for it
Thanks @dsyer
Dave Syer
@dsyer
Jul 10 2017 11:04
If you can create a simple sample that shows the same behaviour it will be easier to analyse
Israel Fernández
@iferca
Jul 10 2017 11:04
Ok I'll do that