beam icon indicating copy to clipboard operation
beam copied to clipboard

Wallet Api. EOF on requests

Open shrikus opened this issue 3 years ago • 4 comments

After migration to 6.0.1 we getting EOF answers from wallet api on requests when wallet-api goes to "sync mode"

wallet-api log:

May 30 06:47:01 p2 wallet-api[25630]: I 2021-05-30.06:47:01.475 got {"id":1,"jsonrpc":"2.0","method":"tx_status","params":{"txId":"328feeef4b464c328f75b2fdda89a1
May 30 06:47:01 p2 wallet-api[25630]: D 2021-05-30.06:47:01.475 executeAPIRequest. Method: tx_status, params: {"txId":"328feeef4b464c328f75b2fdda89a102"}
May 30 06:47:01 p2 wallet-api[25630]: D 2021-05-30.06:47:01.475 Status(txId = 328feeef4b464c328f75b2fdda89a102)
May 30 06:47:05 p2 wallet-api[25630]: D 2021-05-30.06:47:05.586 +peer 127.0.0.1:40790
May 30 06:47:05 p2 wallet-api[25630]: D 2021-05-30.06:47:05.586 on_stream_accepted
May 30 06:47:05 p2 wallet-api[25630]: I 2021-05-30.06:47:05.586 got {"id":1,"jsonrpc":"2.0","method":"tx_status","params":{"txId":"e30a6c3bc3044806a83ff322ccb69d
May 30 06:47:05 p2 wallet-api[25630]: D 2021-05-30.06:47:05.586 executeAPIRequest. Method: tx_status, params: {"txId":"e30a6c3bc3044806a83ff322ccb69d2f"}
May 30 06:47:05 p2 wallet-api[25630]: D 2021-05-30.06:47:05.586 Status(txId = e30a6c3bc3044806a83ff322ccb69d2f)
May 30 06:47:05 p2 wallet-api[25630]: I 2021-05-30.06:47:05.646 Sync up to 1259386-37304f4163cc4a7a
May 30 06:47:05 p2 wallet-api[25630]: I 2021-05-30.06:47:05.646 Synchronizing with node: 0% (0/2)
May 30 06:47:05 p2 wallet-api[25630]: I 2021-05-30.06:47:05.694 Synchronizing with node: 50% (1/2)
May 30 06:47:05 p2 wallet-api[25630]: I 2021-05-30.06:47:05.694 Synchronizing with node: 100% (2/2)
May 30 06:47:05 p2 wallet-api[25630]: I 2021-05-30.06:47:05.694 Current state is 1259386-37304f4163cc4a7a
May 30 06:47:05 p2 wallet-api[25630]: D 2021-05-30.06:47:05.879  IsMobileNodeEnabled()=0 m_Extra.m_ShieldedOutputs=1165 Node shielded outs=1165
May 30 06:47:06 p2 wallet-api[25630]: D 2021-05-30.06:47:06.169 +peer 127.0.0.1:40818
May 30 06:47:06 p2 wallet-api[25630]: D 2021-05-30.06:47:06.169 on_stream_accepted
May 30 06:47:06 p2 wallet-api[25630]: I 2021-05-30.06:47:06.169 got {"id":1,"jsonrpc":"2.0","method":"tx_status","params":{"txId":"66fbed3ff30842f3a0543ec7bfcf4f
May 30 06:47:06 p2 wallet-api[25630]: D 2021-05-30.06:47:06.169 executeAPIRequest. Method: tx_status, params: {"txId":"66fbed3ff30842f3a0543ec7bfcf4f1e"}
May 30 06:47:06 p2 wallet-api[25630]: D 2021-05-30.06:47:06.169 Status(txId = 66fbed3ff30842f3a0543ec7bfcf4f1e)

payouts side:

2021/05/30 06:47:05 Cancelling tx e30a6c3bc3044806a83ff322ccb69d2f
2021/05/30 06:47:05 Failed to cancel tx e30a6c3bc3044806a83ff322ccb69d2f: Post "http://127.0.0.1:8105/api/wallet": EOF

looks like request was totally ignored.

shrikus avatar May 30 '21 12:05 shrikus

Same here, tx_cancel just doesn't work at all, I think it has nothing to do with "sync mode". Getting ECONNRESET/socket hang up on that method, while tx_send or tx_status work flawlessly.

JKKGBE avatar Jun 09 '21 16:06 JKKGBE

the quick fix https://github.com/BeamMW/beam/commit/6cbd73dcb63643a39246798e34248cfecf5882af

anatolse avatar Jun 10 '21 09:06 anatolse

Need to rework _keepalive to handle send error for Async methods and avoid possible timeout. Probably move close connection inside send.

chapati avatar Jun 10 '21 09:06 chapati

Need to add tests (after server code is extracted) or review integration tests for this.

Send consequently

  1. tx_send -> id
  2. tx_cancel (id)

Ensure that connection is not reset

chapati avatar Jun 10 '21 15:06 chapati