Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DJM invokes shutdown listeners only sequentially #71

Open
KazankovMarch opened this issue Jul 20, 2020 · 3 comments
Open

DJM invokes shutdown listeners only sequentially #71

KazankovMarch opened this issue Jul 20, 2020 · 3 comments

Comments

@KazankovMarch
Copy link
Contributor

KazankovMarch commented Jul 20, 2020

Example:

  • SomeJob has many work-items
  • SomeJob has WorkPoolRunningStrategy "Thread per work-item"
  • during its shutdown listener invocation SomeJob waits for closing someResource with long timeout
  • someResource has been broken - it can't be closed gracefully
  • After rebalance worker tries to shutdown execution of SomeJob

It produce very long freeze because DJM shutdowns SomeJob executions sequentially and waits long timeout of closing someResource one time per work-item

@KazankovMarch KazankovMarch added the invalid This doesn't seem right label Jul 22, 2020
@KazankovMarch
Copy link
Contributor Author

KazankovMarch commented Jul 22, 2020

ru.fix.distributed.job.manager.ScheduledJobExecution#shutdown
jobRuns.forEach(JobContext::shutdown);

@KazankovMarch
Copy link
Contributor Author

I think we need to clarify that listener that added by JobContext#addShutdownListener should NOT to shutdown job in listener's Thread, but just send signal to job for closing. DJM waits job's termination by itself in ScheduledJobExecution#awaitTermination (during rebalance) and in Worker#awaitAndTerminate (during closing DJM)

@KazankovMarch
Copy link
Contributor Author

after discussion we decided to clarify our API and give to user possibility to define threadPoolSize of executor in which we will launch shutdown listeners

@KazankovMarch KazankovMarch reopened this Jul 27, 2020
@KazankovMarch KazankovMarch removed the invalid This doesn't seem right label Jul 27, 2020
@KazankovMarch KazankovMarch changed the title DJM shutdowns job executions only sequentially DJM invokes shutdown listeners only sequentially Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant