Hyperledger Fabric - Channel hasn't started yet - apache-kafka

After an unfortunate docker outage, one of our test channels has stopped working properly. This is the output of a previously working “peer chaincode invoke” command:
Error: error sending transaction for invoke: got unexpected status: SERVICE_UNAVAILABLE -- will not enqueue, consenter for this channel hasn't started yet - proposal response: version:1 response:<status:200 payload:"be85bda14845a33cd07db9825d2e473dc65902e6986fdfccea30d8c32385f758" > payload:"\n \364\242+\t\222\216\361\020\024}d7\203\277WY04\233\225vA\376u\330r\2045\312\206\304\333\022\211\001\n3\022\024\n\004lscc\022\014\n\n\n\004strs\022\002\010\004\022\033\n\004strs\022\023\032\021\n\tkeepalive\032\004ping\032E\010\310\001\032#be85bda14845a33cd07db9825d2e473dc65902e6986fdfccea30d8c32385f758\"\013\022\004strs\032\0031.0" endorsement:<endorser:"\n\013BackboneMSP\022\203\007-----BEGIN CERTIFICATE----- etc. more output removed from here
I find this in the orderer's log:
2019-07-29 14:46:50.930 UTC [orderer/consensus/kafka] try -> DEBU 3c10 [channel: steel] Connecting to the Kafka cluster
2019-07-29 14:46:50.931 UTC [orderer/consensus/kafka] try -> DEBU 3c11 [channel: steel] Need to retry because process failed = kafka server: The requested offset is outside the range of offsets maintained by the server for the given topic/partition.
2019-07-29 14:46:56.967 UTC [common/deliver] Handle -> WARN 3c12 Error reading from 10.0.0.4:32800: rpc error: code = Canceled desc = context canceled
2019-07-29 14:46:56.967 UTC [orderer/common/server] func1 -> DEBU 3c13 Closing Deliver stream
2019-07-29 14:46:56.972 UTC [orderer/common/server] Deliver -> DEBU 3c14 Starting new Deliver handler
2019-07-29 14:46:56.972 UTC [common/deliver] Handle -> DEBU 3c15 Starting new deliver loop for 10.0.0.4:32802
2019-07-29 14:46:56.973 UTC [common/deliver] Handle -> DEBU 3c16 Attempting to read seek info message from 10.0.0.4:32802
2019-07-29 14:46:56.973 UTC [common/deliver] deliverBlocks -> WARN 3c17 [channel: steel] Rejecting deliver request for 10.0.0.4:32802 because of consenter error
2019-07-29 14:46:56.973 UTC [common/deliver] Handle -> DEBU 3c18 Waiting for new SeekInfo from 10.0.0.4:32802
2019-07-29 14:46:56.973 UTC [common/deliver] Handle -> DEBU 3c19 Attempting to read seek info message from 10.0.0.4:32802
2019-07-29 14:46:56.995 UTC [common/deliver] Handle -> WARN 3c1a Error reading from 10.0.0.23:49844: rpc error: code = Canceled desc = context canceled
2019-07-29 14:46:56.995 UTC [orderer/common/server] func1 -> DEBU 3c1b Closing Deliver stream
And this is from the endorser peer’s log:
2019-07-29 15:14:17.829 UTC [ConnProducer] DisableEndpoint -> WARN 3d6 Only 1 endpoint remained, will not black-list it
2019-07-29 15:14:17.834 UTC [blocksProvider] DeliverBlocks -> WARN 3d7 [steel] Got error &{SERVICE_UNAVAILABLE}
2019-07-29 15:14:27.839 UTC [blocksProvider] DeliverBlocks -> WARN 3d8 [steel] Got error &{SERVICE_UNAVAILABLE}
I use these docker images:
hyperledger/fabric-kafka:0.4.10
hyperledger/fabric-orderer:1.2.0
hyperledger/fabric-peer:1.2.0
Based on the above, I assume that the consistency between the orderer and the corresponding kafka topic is broken. It also doesn't help if I redirect requests to another orderer or force to change the kafka topic leader. Is it correct that if KAFKA_LOG_RETENTION_MS=-1 had been set, this error would probably have been prevented?
After reviewing the archives, I found that it is not possible to fix this error. As I see it, I can't shutdown only one channel, and I even have to stop all the peers subscribed to the channel if I don't want continuous error messages in the orderer logs. What is the best practice in cases like mine?
Regards;
Sandor

consenter error
which means before connection made b/w kafka & orderer you are trying
to do some operations.
Which means there is an error present in between kafka and orderer
Note: Probably you might have set up a connection which is not stable
Try to check the logs of orderer it should have a message posted
successfully.
whenever Kafka, orderer try to connect, orderer will post a message if it
successfully posted to a topic which means you have configured correctly
Make sure connection b/w kafka and orderer are configured correctly
2019-07-29 14:46:50.931 UTC [orderer/consensus/kafka] try -> DEBU 3c11 [channel: steel] Need to retry because process failed = kafka server: The requested offset is outside the range of offsets maintained by the server for the given topic/partition.
By above clue, it is complete with Kafka nothing todo with the orderer
try check this

Related

Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context

I have been trying to deploy a hyperledger fabric model with 3 CAs 1 orderer and 2 peer nodes. I am able to create the channel with OSADMIN command of fabric but when I try to join the channel with peer node, I get Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context...... .
Here are the logs from terminal (local host machine):
2021-06-01 06:38:54.509 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2021-06-01 06:38:54.522 UTC [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /etc/hyperledger/clipod/configtx/configtx.yaml
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 006 Creating application channel genesis block
2021-06-01 06:38:54.712 UTC [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
cli-dd4cc5fbf-pdcgb
Status: 201
{
"name": "commonchannel",
"url": "/participation/v1/channels/commonchannel",
"consensusRelation": "consenter",
"status": "active",
"height": 1
}
cli-dd4cc5fbf-pdcgb
Error: error getting endorser client for channel: endorser client failed to connect to peer-govt:7051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
Error: error getting endorser client for channel: endorser client failed to connect to peer-general:9051: failed to create new connection: context deadline exceeded
command terminated with exit code 1
One thing to note down here is I am using Kubernetes and service CLUSTER_IP for all the PODS.
here are logs from one of the PEER POD (same for other)
2021-06-01 06:38:42.180 UTC [nodeCmd] registerDiscoveryService -> INFO 01b Discovery service activated
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -> INFO 01c Starting peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.180 UTC [nodeCmd] func6 -> INFO 01d Starting profiling server with listenAddress = 0.0.0.0:6060
2021-06-01 06:38:42.180 UTC [nodeCmd] serve -> INFO 01e Started peer with ID=[peer-govt], network ID=[dev], address=[peer-govt:7051]
2021-06-01 06:38:42.181 UTC [kvledger] LoadPreResetHeight -> INFO 01f Loading prereset height from path [/var/hyperledger/production/ledgersData/chains]
2021-06-01 06:38:42.181 UTC [blkstorage] preResetHtFiles -> INFO 020 No active channels passed
2021-06-01 06:38:56.006 UTC [core.comm] ServerHandshake -> ERRO 021 Server TLS handshake failed in 24.669µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:13258
2021-06-01 06:38:57.007 UTC [core.comm] ServerHandshake -> ERRO 022 Server TLS handshake failed in 17.772µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:29568
2021-06-01 06:38:58.903 UTC [core.comm] ServerHandshake -> ERRO 023 Server TLS handshake failed in 13.581µs with error tls: first record does not look like a TLS handshake server=PeerServer remoteaddress=172.17.0.1:32615
To overcome this issue, I tried disabling the TLS by setting CORE_PEER_TLS_ENABLED to FALSE
then the proposal gets submitted but the orderer POD throws the same error of TLS handshake failed.........
Here are the commands I am using to join the channel from cli pod:
kubectl -n hyperledger -it exec $CLI_POD -- sh -c "export FABRIC_CFG_PATH=/etc/hyperledger/clipod/config && export CORE_PEER_LOCALMSPID=GeneralMSP && export CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/peers/peer0.general.example.com/tls/ca.crt && export CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/clipod/organizations/peerOrganizations/general.example.com/users/Admin#general.example.com/msp && export CORE_PEER_ADDRESS=peer-general:9051 && peer channel join -b /etc/hyperledger/clipod/channel-artifacts/$CHANNEL_NAME.block -o orderer:7050 --tls --cafile /etc/hyperledger/clipod/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
I am stuck on this problem, any help will be appreciated.
Thank you
I have fixed it. The issue I was facing was because of not setting the CORE_PEER_TLS_ENABLED = true for CLI pod.
One thing I have got learn from this whole model, whenever you see TLS issue, first to check for would be checking CORE_PEER_TLS_ENABLED variable. Make sure you have set it for all the pods or containers you are trying to interact with. The case can be false(for no TLS) or true(for using TLS) depending on your deployment.
Other things to keep in mind is using the correct variables of fabric including FABRIC_CFG_PATH, CORE_PEER_LOCALMSPID, CORE_PEER_TLS_ROOTCERT_FILE, CORE_PEER_MSPCONFIGPATH and some others depending on your command.

kafka-based OSN in local single-host Fabric network, But NO logs in the kafka containers when I perform transactions

I have set up a fabric netowork consisting of 1org: 1CA, 1peer, 1orderer, couchdb.
Now, my approach for setting up kafka-based ordering service was:
In the configtx file
1. I made orderer type to kafka.
2. Added a single orderer address (orderer.example.com)
3. Added 4 kafka brokers(kafka0.example.com:9092...)
Then I generated the genesis and channel config files using the above set up in the configtx.
Then I Updated my docker-compose.yaml file to include the kafka and zookeeper containers.
Finally brought up the entire network using docker-compose -f ... up -d
The problem is when I submit transactions, I see the orderer logs updating, but no change or update in the kafka logs. Although the orderer shows some kafka related logs like [kafka/consensus]....
2019-07-27 17:29:32.646 UTC [orderer/common/blockcutter] Ordered -> DEBU 3c1 Enqueuing message into batch
2019-07-27 17:29:32.646 UTC [orderer/consensus/kafka] func1 -> DEBU 3c2 [channel: mychannel] Ordering results: items in batch = 0, pending = true
2019-07-27 17:29:32.646 UTC [orderer/consensus/kafka] func1 -> DEBU 3c3 [channel: mychannel] Just began 2s batch timer
2019-07-27 17:29:32.647 UTC [orderer/consensus/kafka] enqueue -> DEBU 3c4 [channel: mychannel] Envelope enqueued successfully
2019-07-27 17:29:32.647 UTC [orderer/common/broadcast] Handle -> DEBU 3c5 [channel: mychannel] Broadcast has successfully enqueued message of type ENDORSER_TRANSACTION from 172.22.0.14:36112
2019-07-27 17:29:32.651 UTC [orderer/common/broadcast] Handle -> WARN 3c7 Error reading from 172.22.0.14:36112: rpc error: code = Canceled desc = context canceled
2019-07-27 17:29:32.651 UTC [orderer/common/server] func1 -> DEBU 3c8 Closing Broadcast stream
2019-07-27 17:29:34.647 UTC [orderer/consensus/kafka] sendTimeToCut -> DEBU 3c9 [channel: mychannel] Time-to-cut block 2 timer expired
2019-07-27 17:29:34.707 UTC [orderer/consensus/kafka] processMessagesToBlocks -> DEBU 3ca [channel: mychannel] Successfully unmarshalled consumed message, offset is 6. Inspecting type...
2019-07-27 17:29:34.707 UTC [orderer/consensus/kafka] processTimeToCut -> DEBU 3cb [channel: mychannel] It's a time-to-cut message for block 2
2019-07-27 17:29:34.707 UTC [orderer/consensus/kafka] processTimeToCut -> DEBU 3cc [channel: mychannel] Nil'd the timer
2019-07-27 17:29:34.707 UTC [orderer/consensus/kafka] processTimeToCut -> DEBU 3cd [channel: mychannel] Proper time-to-cut received, just cut block 2
The kafka logs only update when the kafka broker starts and channel is created etc. I am confused whether my kafka based ordering is working or is it just working like a solo orderer.
I have also observed the orderer communication with the brockers perriodically

Kafka gives Invalid receive size with Hyperledger Fabric Orderer connection

I was setting up a new cluster for Hyperledger Fabric on EKS. The cluster has 4 kafka nodes, 3 zookeeper nodes, 4 peers, 3 orderers, 1 CA. All the containers come up individually, and the kafka/zookeeper backend is also stable. I can SSH into any kafka/zookeeper and check for connections to any other nodes, create topics, post messages etc. The kafka is accessible via Telnet from all orderers.
When I try to create a channel I get the following error from the orderer:
2019-04-25 13:34:17.660 UTC [orderer.common.broadcast] ProcessMessage -> WARN 025 [channel: channel1] Rejecting broadcast of message from 192.168.94.15:53598 with SERVICE_UNAVAILABLE: rejected by Consenter: backing Kafka cluster has not completed booting; try again later
2019-04-25 13:34:17.660 UTC [comm.grpc.server] 1 -> INFO 026 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=192.168.94.15:53598 grpc.code=OK grpc.call_duration=14.805833ms
2019-04-25 13:34:17.661 UTC [common.deliver] Handle -> WARN 027 Error reading from 192.168.94.15:53596: rpc error: code = Canceled desc = context canceled
2019-04-25 13:34:17.661 UTC [comm.grpc.server] 1 -> INFO 028 streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=192.168.94.15:53596 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=24.987468ms
And the Kafka leader reports the following error:
[2019-04-25 14:07:09,453] WARN [SocketServer brokerId=2] Unexpected error from /192.168.89.200; closing connection (org.apache.kafka.common.network.Selector)
org.apache.kafka.common.network.InvalidReceiveException: Invalid receive (size = 369295617 larger than 104857600)
at org.apache.kafka.common.network.NetworkReceive.readFromReadableChannel(NetworkReceive.java:132)
at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:93)
at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:231)
at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:192)
at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:528)
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:469)
at org.apache.kafka.common.network.Selector.poll(Selector.java:398)
at kafka.network.Processor.poll(SocketServer.scala:535)
at kafka.network.Processor.run(SocketServer.scala:452)
at java.lang.Thread.run(Thread.java:748)
[2019-04-25 14:13:53,917] INFO [GroupMetadataManager brokerId=2] Removed 0 expired offsets in 0 milliseconds. (kafka.coordinator.group.GroupMetadataManager)
The error indicates that you are receiving messages larger than the permitted maximum size, that defaults to ~100MB. Try to increase the following property in server.properties file, so that it can fit larger receive (in this case at least 369295617 bytes):
# Set to 500MB
socket.request.max.bytes=500000000
and then restart your Kafka Cluster.
If this doesn't work for you, then I guess that you are trying to connect to a non-SSL listener. Therefore, you'd have to verify that broker's SSL listener port is 9092 (or the corresponding port in case you are not using the default one) . The following should do the trick:
listeners=SSL://:9092
advertised.listeners=SSL://:9092
inter.broker.listener.name=SSL

Hyperledger Orderer is not working with Kafka - error decoding packet: CRC didn't match

I am trying to launching Hyperledger Fabric Orderer with Kafka. I have four Kafka brokers. I am getting the following error.
2018-12-24 16:15:39.795 CST [orderer/consensus/kafka] processMessagesToBlocks -> ERRO 0ec [channel: ordererchannel] Error during consumption: kafka: error while consuming ordererchannel/0: kafka: error decoding packet: CRC didn't match expected 0x0 got 0xe38a6876
2018-12-24 16:15:39.796 CST [orderer/consensus/kafka] processMessagesToBlocks -> WARN 0ed [channel: ordererchannel] Deliver sessions will be dropped if consumption errors continue.
2018-12-24 16:15:41.796 CST [orderer/consensus/kafka/sarama] dispatcher)-fm -> DEBU 0ee consumer/ordererchannel/0 finding new broker
2018-12-24 16:15:41.796 CST [orderer/consensus/kafka/sarama] RefreshMetadata -> DEBU 0ef client/metadata fetching metadata for [ordererchannel] from broker 192.168.1.36:9092
2018-12-24 16:15:41.809 CST [orderer/consensus/kafka/sarama] Open -> DEBU 0f0 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
2018-12-24 16:15:41.809 CST [orderer/consensus/kafka/sarama] subscriptionConsumer -> DEBU 0f1 consumer/broker/3 added subscription to ordererchannel/0
2018-12-24 16:15:41.810 CST [orderer/consensus/kafka] processMessagesToBlocks -> WARN 0f2 [channel: ordererchannel] Consumption will resume.
2018-12-24 16:15:41.816 CST [orderer/consensus/kafka/sarama] withRecover -> DEBU 0f3 Connected to broker at 192.168.1.50:9092 (registered as #3)
2018-12-24 16:15:41.832 CST [orderer/consensus/kafka/sarama] subscriptionConsumer)-fm -> DEBU 0f4 consumer/broker/3 disconnecting due to error processing FetchRequest: kafka: error decoding packet: CRC didn't match expected 0x0 got 0xe38a6876
2018-12-24 16:15:41.833 CST [orderer/consensus/kafka/sarama] abort -> DEBU 0f5 Closed connection to broker 192.168.1.50:9092
I am using Kafka 2.0 and hyperledger fabirc 1.3.0.

docker-compose-simple.yaml file giving error while composing it for running Chaincode in docker devmode

I have Fabric v1.1 running on my Ubuntu and Below are the details of the error message which I got after running docker-compose-simple.yaml file from Fabric-Samples/Chaincode-docker-devmode path.
orderer | 2018-06-30 12:17:02.810 UTC [common/configtx] addToMap -> DEBU 167 Adding to config map: [Value] /Channel/Consortium orderer | 2018-06-30 12:17:02.911 UTC [orderer/common/broadcast] Handle -> WARN 168 [channel: myc] Rejecting broadcast of config message from 172.20.0.5:52566 because of error: error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1 –
orderer | 2018-06-30 12:17:03.129 UTC [common/deliver] Handle -> WARN 16a Error reading from 172.20.0.5:52564: rpc error: code = Canceled desc = context canceled orderer | 2018-06-30 12:17:03.129 UTC [orderer/common/server] func1 -> DEBU 16b Closing Deliver stream