Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a system administrator I need the composer-rest-server to tolerate unavailable peers #2799

Closed
davidkel opened this issue Nov 21, 2017 · 2 comments

Comments

Projects
None yet
1 participant
@davidkel
Copy link
Contributor

commented Nov 21, 2017

Composer currently handles responses that could not be sent to the peer, but currently still doesn't do anything around event handling or query chaincode. Here are the issues that need to be considered.

  • Composer only sends a query to a single Peer. What if that peer is unavailable ?
  • Events emitted from business networks are listened for only on a single peer. What if that peer is unavailable
  • Composer currently tries to listen for events for all peers listed in the connection profile, but if the connection to that peer has been lost you will get errors such as
(node:21071) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): Error: The event hub has not been connected to the event source
(node:21071) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 7)
Unhandled error for request POST /api/User: Error: Error trying invoke business network. Error: The event hub has not been connected to the event source
    at _initializeChannel.then.then.then.then.catch (/root/.nvm/versions/node/v6.11.3/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:888:34)
    at process._tickCallback (internal/process/next_tick.js:109:7)

A rethink of how to listen for transaction completion events needs to be done because not receiving the event doesn't mean that the transaction didn't complete. We need to think about the following

  • before trying to register for a tx event we should try to reconnect any event hubs we are not connected to (eg were connected but lost connection)
  • attempt to register for a tx event on either (user configurable)
    • all connected event hubs (assumption is that all event hubs here we are allowed to connect to)
    • the first event hub that registers successfully
  • for the all event hub scenario, if we fail to register, then we just don't bother with that event hub. We could fail because it isn't connected or for some other reason as the register can throw an error.

We would also want to do something similar for the business event emission as well except it should only register one listener for the first event hub that allows it.

Some of this is likely to be something the fabric node sdk should handle rather than composer and also needs to be considered within the context of the Common Connection Profile implementation coming in fabric 1.1

@davidkel

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2018

#3014 enhances the event handling system to make it recover from loss of connection to event hubs. The only outstanding issue is loss of connection to a peer for querying

@davidkel

This comment has been minimized.

Copy link
Contributor Author

commented Mar 16, 2018

No in master.

@davidkel davidkel closed this Mar 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.