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

Fixes #2622 clear some state during reload #2627

Merged
merged 1 commit into from
May 30, 2019

Conversation

stuartwdouglas
Copy link
Member

After a reload we need to clear out old ThreadLocal data,
and Hystrix is also caching some things in statics

After a reload we need to clear out old ThreadLocal data,
and Hystrix is also caching some things in statics
@gsmet
Copy link
Member

gsmet commented May 29, 2019

@dmlloyd any chance you could review this one?

*
* This is only for development mode, it must not be used for production applications.
*
* TODO: should this just provide a facacde that simply starts a new thread pool instead?
Copy link
Member

@dmlloyd dmlloyd May 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that would be a bit cleaner: just start a new pool, swap it in, and shut down the old one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you would need to also re-dispatch the current HTTP thread to the new pool, to prevent old context from hanging around.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach works for now, this approach was listed as a todo because it would need a lot more testing (which is mostly manual testing at the moment as we do not have a good way to test dev mode).

This is a very low risk approach as it is basically the status quo with some fixes. Changing the behaviour of dev mode and hot reload has much more potential for regressions, which is why I left it as a TODO item.

}

/**
* copied from JBoss threads
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there should be an API for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its all package private

Copy link
Member

@dmlloyd dmlloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure about this approach (see comments).

HystrixThreadPoolCompletionStream.reset();
HystrixCommandStartStream.reset();
HystrixThreadEventStream.getInstance().shutdown();
Hystrix.reset();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hystrix.reset() should not be necessary as we call it when the CDI app context is destroyed - https://github.com/smallrye/smallrye-fault-tolerance/blob/master/implementation/src/main/java/io/smallrye/faulttolerance/HystrixInitializer.java#L64. I'm not sure about the streams though. But better safe than sorry.

@gsmet gsmet added this to the 0.16.0 milestone May 30, 2019
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go for the safe approach first and revisit that later.

@stuartwdouglas could you open an issue drafting the approach we should follow in the future. Better that than having a comment buried in the code.

@gsmet gsmet merged commit 0cb4808 into quarkusio:master May 30, 2019
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

Successfully merging this pull request may close these issues.

4 participants