From 9d86c565299bef7cb1b2ed6869c212c726693cd3 Mon Sep 17 00:00:00 2001 From: Alexander Koshevoy Date: Wed, 30 May 2018 17:51:51 +0300 Subject: [PATCH] PY-18029 Race condition on async value evaluation fixed `myCallbackHashMap` with the freshly requested async evaluation sequence number was accessed in `returnFullValue()` method before putting this sequence value into the map in `loadAsyncVariablesValues()` method. This resulted in NPE after switching to the new fast Thrift transport. --- .../jetbrains/python/console/PydevConsoleCommunication.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/src/com/jetbrains/python/console/PydevConsoleCommunication.java b/python/src/com/jetbrains/python/console/PydevConsoleCommunication.java index 5982acac28d1..b21305319001 100644 --- a/python/src/com/jetbrains/python/console/PydevConsoleCommunication.java +++ b/python/src/com/jetbrains/python/console/PydevConsoleCommunication.java @@ -544,11 +544,11 @@ public class PydevConsoleCommunication extends AbstractConsoleCommunication impl evaluationExpressions.add(GetVariableCommand.composeName(asyncValue.getDebugValue())); } final int seq = getNextFullValueSeq(); + myCallbackHashMap.put(seq, pyAsyncValues); + // @alexander todo add specific exception to the method (previously processed by `checkError()`) myClient.loadFullValue(seq, evaluationExpressions); - myCallbackHashMap.put(seq, pyAsyncValues); - // @alexander todo it was expected here that `loadFullValue()` might return `List` somehow... } // @alexander todo uncomment probably