[SCRIPT] ScriptService can deadlock entire nodes if script index is recovering

we currently have operationThreaded set to false when indexing a script. This setting
means that if we are executing the operation locally that we don't spawn a new thread for
it althought incoming thread in this case is the network thread. Now sicne we are indexing here
the engine is currently recovering which sometimes locks the engine for finalization blocks on
a network call waiting for the recovery target to come back the internal lock in engine will never be
released since we are waiting with our network thread for it to be released.
This commit is contained in:
Simon Willnauer 2014-12-11 15:37:32 +01:00
parent ba881a9b58
commit 123fb2f5db
2 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ public class TransportGetIndexedScriptAction extends HandledTransportAction<GetI
@Override
public void doExecute(GetIndexedScriptRequest request, final ActionListener<GetIndexedScriptResponse> listener){
// forward the handling to the script service we are running on a network thread here...
scriptService.queryScriptIndex(request,new ActionListener<GetResponse>() {
scriptService.queryScriptIndex(request, new ActionListener<GetResponse>() {
@Override
public void onResponse(GetResponse getFields) {
listener.onResponse(new GetIndexedScriptResponse(getFields));

View File

@ -361,7 +361,7 @@ public class ScriptService extends AbstractComponent {
String scriptLang = validateScriptLanguage(request.scriptLang());
GetRequest getRequest = new GetRequest(request, SCRIPT_INDEX).type(scriptLang).id(request.id())
.version(request.version()).versionType(request.versionType())
.operationThreaded(false).preference("_local"); //Set preference for no forking
.preference("_local"); //Set preference for no forking
client.get(getRequest, listener);
}
@ -416,7 +416,7 @@ public class ScriptService extends AbstractComponent {
validate(request.safeSource(), scriptLang);
IndexRequest indexRequest = new IndexRequest(request).index(SCRIPT_INDEX).type(scriptLang).id(request.id())
.listenerThreaded(false).operationThreaded(false).version(request.version()).versionType(request.versionType())
.version(request.version()).versionType(request.versionType())
.source(request.safeSource(), true).opType(request.opType()).refresh(true); //Always refresh after indexing a template
client.index(indexRequest, listener);
}