aleth icon indicating copy to clipboard operation
aleth copied to clipboard

Cannot connect to Aleth via IPC

Open halfalicious opened this issue 5 years ago • 2 comments

I'm running Aleth locally (built from source, head = 2fd5c084b 3a815618b) with a private chain configuration on Windows 10 and I'm having difficulty connecting to it via IPC using Truffle. Sometimes I'm able to connect and deploy a contract, but more often than not I get the following error in response to executing Truffle migrate or Truffle console:

truffle migrate --network dev

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

CONNECTION ERROR: Couldn't connect to node on IPC.
Truffle v5.0.35 (core: 5.0.35)
Node v10.16.2

I don't see any errors or warnings being logged by Aleth to the console so I'm not sure if this is a Truffle/web3 provider issue or an Aleth issue.

halfalicious avatar Sep 08 '19 22:09 halfalicious

Looks like Aleth receives the incoming IPC connection:

0:021> k
 # Child-SP          RetAddr           Call Site
00 000000a3`9c9ff4f0 00007ff7`8b1c8c4f aleth!dev::IpcServerBase<void *>::GenerateResponse+0x8f [C:\Users\nilse\Documents\Code\aleth\libweb3jsonrpc\IpcServerBase.cpp @ 105] 
01 000000a3`9c9ffa10 00007ff7`8b1c6b8b aleth!<lambda_76dfc224eff8ca070c57a9d25bef54c0>::operator()+0x1f [C:\Users\nilse\Documents\Code\aleth\libweb3jsonrpc\WinPipeServer.cpp @ 65] 
02 000000a3`9c9ffa40 00007ff7`8b1c84bb aleth!std::_Invoker_functor::_Call<<lambda_76dfc224eff8ca070c57a9d25bef54c0> >+0x1b [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\type_traits @ 1457] 
03 000000a3`9c9ffa70 00007ff7`8b1c7e0e aleth!std::invoke<<lambda_76dfc224eff8ca070c57a9d25bef54c0> >+0x1b [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\type_traits @ 1457] 
04 000000a3`9c9ffaa0 00007fff`9df6d9f2 aleth!std::thread::_Invoke<std::tuple<<lambda_76dfc224eff8ca070c57a9d25bef54c0> >,0>+0x4e [C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.22.27905\include\thread @ 39] 
05 000000a3`9c9ffaf0 00007fff`9eeb7bd4 ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>+0x42
06 000000a3`9c9ffb20 00007fff`a09ace71 KERNEL32!BaseThreadInitThunk+0x14
07 000000a3`9c9ffb50 00000000`00000000 ntdll!RtlUserThreadStart+0x21
0:021> dv
           this = 0x000001fd`255dadc0
    _connection = 0x00000000`000004d8
         buffer = char [1024] "{"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}"
       inString = false
         nbytes = 0x3b
         escape = false
              i = 0
          depth = 0n0
        request = ""

halfalicious avatar Sep 08 '19 22:09 halfalicious

It looks like when I try to open a Truffle development console connection to Aleth, Truffle executes 3 RPC queries - net_version and 2 instances of eth_accounts. I need to investigate which query is failing and why. I've verified when I can successfully connect to Aleth, the RPC functions are called into (Net::net_version and Eth::eth_accounts). List of queries:


WARN  09-08 16:05:20 <unknown> rpc    {"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}
WARN  09-08 16:05:20 <unknown> rpc    {"jsonrpc":"2.0","id":2,"method":"eth_accounts","params":[]}
WARN  09-08 16:05:20 <unknown> rpc    {"jsonrpc":"2.0","id":3,"method":"eth_accounts","params":[]}

It looks like one can enable verbose RPC traffic logging in Truffle via the --verbose-rpc switch, I'll do that and examine the traffic

halfalicious avatar Sep 08 '19 22:09 halfalicious