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
Clear the GroovyClassLoader cache before compiling #8062
Conversation
++ I think this is a a bug really no? should it go to 1.3.5 and 1.4 too? LGTM |
Refactored this after talking with @kimchy, this is now implemented as a listener where the classloader is only cleared when scripts are removed from the cache. I tested this with the script from #7658 and I was able to send/compile 10,000 unique scripts on both Java 7 and 8 without running into PermGen issues. |
if (logger.isDebugEnabled()) { | ||
logger.debug("notifying script services of script removal due to: [{}]", notification.getCause()); | ||
} | ||
for (ScriptEngineService service : scriptEngines.values()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe catch exceptions here and put them into an arraylist, you can then just use ExceptionHelper to rerthrow and surpress....it has a utility for this
left minor comments - LGTM |
8f11d42
to
2c6d31d
Compare
Since we don't use the cache, it's okay to clear it entirely if needed, Elasticsearch maintains its own cache for compiled scripts. Adds loader.clearCache() into a listener, the listener is called when a script is removed from the Guava cache. This also lowers the amount of cached scripts to 100, since 500 is around the limit some users have run into before hitting an out of memory error in permgem. Fixes elastic#7658
This one breaks script plugins for elasticsearch 1.3.5, 1.4.0 and above. A new method in void scriptRemoved(@Nullable CompiledScript script); |
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #29. (cherry picked from commit 1fd05bc)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #29. (cherry picked from commit 1fd05bc)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #29.
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #29. (cherry picked from commit 1fd05bc)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #6. (cherry picked from commit 3985cec)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #6. (cherry picked from commit 3985cec)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #6.
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript`. Closes #23. (cherry picked from commit 8afd168)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript`. Closes #23. (cherry picked from commit 8afd168)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #23. (cherry picked from commit 8afd168)
…Service` This [PR](elastic/elasticsearch#8062) broke ScriptEngineService by adding a new method `scriptRemoved(CompiledScript)`. Closes #23.
Since we don't use the cache, it's okay to clear it entirely if needed,
Elasticsearch maintains its own cache for compiled scripts.
Fixes #7658
Fixes #8073