question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API dies if querying after disconnect

See original GitHub issue

Reproduce:

await api.disconnect()

await api.derive.staking.stakerRewards(`FPstA2NF8wH4d8Z3VWhmALLSpcMi8Tttsv8jsJNZvL1y7GA`, 581)
  .catch(console.error);
console.log("Should be reached");

“Should be reached” will never be called

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
kushptlapigaragecommented, May 26, 2020

I found same issue with out implementation. Here are the steps I took

  1. connect to remote Substrate Node using @polkadotjs/api . I used ApiPromise.create()
  2. Do simple queries using api.query.* methods
  3. Shutdown WiFi ( simulates remote disconnect ). API Node is disconnected
  4. Do another request using api.query.* method . The request should return as Failed but it halts
  5. Start WiFi . Make another req using api.query.* method . This req does not return i.e. no response
2reactions
jacogrcommented, May 8, 2020

Thanks for logging.

Did an initial look-though and it def seems like an issue. So subscriptions are handled in a way where they re-connect, i.e. it will continue where it left off and but single-shot items don’t quite get handled the same. It should either -

  • like subs, retry on re-connect, or
  • throw an exception (which will be caught)

Just need to think through consistency and “least surprise” here. (Since we actually have round-robin on providers now as well where it can swap from one to another, the first one may be useful)

Read more comments on GitHub >

github_iconTop Results From Across the Web

(SSMS) How do you prevent an open tab from querying a DB ...
In SSMS if you have a tab open with a query and then you disconnect the database you can still run the query...
Read more >
78809: MySQL keeps running queries for disconnected users
Description: if a user disconnects from MySQL with a query still running, MySQL will keep running that query forever as long as no...
Read more >
Postgresql cancel query on client disconnect with php
A possible solution is to use pg_send_query(), that function sends a query to the database and returns immediatly without blocking.
Read more >
Database Host Server Connections Drop after a Period ... - IBM
Network hardware causes connection drops after a period of inactivity. The disconnects might be prevented with changes to hardware settings ...
Read more >
"MySQL server has gone away" error - Solution(s)
It's also when waiting for the first response from the MySQL server. ... running queries can be disconnected after default_socket_timeout ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found