When i used the encrypted wallet to test transfer parallelly,i frequently got the trouble: The rpc server is not responding.My test script is like below:
#!/bin/sh
while [ 1 ]
do
./bitcoin-cli listaddressgroupings>null
./bitcoin-cli walletpassphrase "!@#$%^&*" 2
./bitcoin sendtoaddress "mhAW6mzs5DeCbzBUHXBi4U446Fdnr1z8U7" 0.01
done

When i open the dead lock trace macro and check the debug log,i found the last print is as below:
2018-12-17 08:27:58 ThreadRPCServer method=walletpassphrase
2018-12-17 08:27:58 LOCKCONTENTION: cs_main
2018-12-17 08:27:58 Locker: wallet/rpcwallet.cpp:2642
2018-12-17 08:27:58 LOCKCONTENTION: pWallet->cs_wallet
2018-12-17 08:27:58 Locker: wallet/rpcwallet.cpp:2607

The line no 2642 is walletpassphrase and 2607 is LockWallet. I checked the code,i found there is no log printed for this line in function "walletpassphrase":
"LogPrint(BCLog::RPC, "queue run of timer %s in %i seconds (using %s)\n", name, nSeconds, timerInterface->Name());" So i guess the reason may be:
When "walletpassphrase" is running and lock the cs_wallet,the last relock timer triggered and call "LockWallet"."LockWallet" want to lock the cs_wallet but it has been locked by "walletpassphrase",so "LockWallet" is blocked.When "walletpassphrase" run to call "RPCRunLater",the function will erase the timer from the std::map "deadlineTimers",but the timer's timeout call is blocked,so the dead lock take place.
Is my guess right?
How to reslove the issue?
Any help will be appreciative！
{RPCResult::Type::ARR, "removed", "<structure is the same as \"transactions\" above, only present if include_removed=true>\n"
                            "Note: transactions that were re-added in the active chain will appear as-is in this array, and may thus have a positive confirmation count."
                        , {{RPCResult::Type::ELISION, "", ""},}},
                        {RPCResult::Type::STR_HEX, "lastblock", "The hash of the block (target_confirmations-1) from the best block on the main chain. This is typically used to feed back into listsinceblock the next time you call it. So you would generally use a target_confirmations of say 6, so you will be continually re-notified of transactions until they've reached 6 confirmations plus any new ones"},
                    }
                },
                RPCExamples{
                    HelpExampleCli("listsinceblock", "")
            + HelpExampleCli("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6")
            + HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
                },
            }.Check(request);
    
    
    pwallet->BlockUntilSyncedToCurrentChain();
    auto locked_chain = pwallet->chain().lock();
    LOCK(pwallet->cs_wallet);
    
    Optional<int> height = MakeOptional(false, int()); 
    Optional<int> altheight; 
    int target_confirms = 1;
    isminefilter filter = ISMINE_SPENDABLE;
    uint256 blockId;
    if (!request.params[0].isNull() && !request.params[0].get_str().empty()) {
        blockId = ParseHashV(request.params[0], "blockhash");
        height = locked_chain->findFork(blockId, &altheight);
        if (!height) {
            throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
        }
    }