You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test network incorrectly recreates a fabric network when creating a channel #1243
./network.sh up -s couchdb
./network.sh createChannel -c mychannel
results in the fabric network being recreated by the createChannel command using levelDB. The reason for this is due to this check in the createChannel Function of network.sh
as no fabric-tools image now pulled and launched the check that there are less than 4 images running is not correct.
I do have to question as to why does the createChannel attempt to start a network if no network exists ? The paradigm of doing a single action may be better here and just have the up command do it
Hi @davidkel , I looked into the logic in createChannel, and the main issue seems to be that the network existence check is relying on an outdated container-count assumption.
can incorrectly decide that the network is not running, which causes createChannel to recreate the network with the default database settings. As noted in the issue, this is especially visible after bringing the network up with CouchDB and then running ./network.sh createChannel -c mychannel.
A safer fix would be to stop depending on the number of running containers as the primary signal. Container count is fragile because it changes when images/services are added or removed. Instead, createChannel should check for artifacts that actually indicate an initialized network, such as the generated organization materials or active peer/orderer containers by name. The quick fix suggested in the issue (-lt 3 instead of -lt 4) may solve the immediate regression, but it still keeps the same brittle approach.
And if container validation is still needed, it would be better to explicitly check for expected Fabric services rather than a hardcoded total count.
So my proposed fix is:
Remove or de-prioritize the hardcoded len threshold check.
Use generated crypto/org artifacts as the main network-ready signal.
Optionally verify expected peer/orderer containers by name.
Keep createChannel focused on channel creation and avoid silently recreating the network unless it is truly missing. This matches the issue’s concern that up and createChannel should have clearer separation of responsibility.
I’d be happy to work on this by first applying the minimal fix for the current regression, and then cleaning up the detection logic so it is less dependent on environment-specific container counts.
test network incorrectly recreates a fabric network when creating a channel
Activity
SurbhiAgarwal1 commentedon Apr 13, 2026
Hi @davidkel , I looked into the logic in
createChannel, and the main issue seems to be that the network existence check is relying on an outdated container-count assumption.Right now, this condition:
can incorrectly decide that the network is not running, which causes
createChannelto recreate the network with the default database settings. As noted in the issue, this is especially visible after bringing the network up with CouchDB and then running./network.sh createChannel -c mychannel.A safer fix would be to stop depending on the number of running containers as the primary signal. Container count is fragile because it changes when images/services are added or removed. Instead,
createChannelshould check for artifacts that actually indicate an initialized network, such as the generated organization materials or active peer/orderer containers by name. The quick fix suggested in the issue (-lt 3instead of-lt 4) may solve the immediate regression, but it still keeps the same brittle approach.A more robust direction would be:
And if container validation is still needed, it would be better to explicitly check for expected Fabric services rather than a hardcoded total count.
So my proposed fix is:
lenthreshold check.createChannelfocused on channel creation and avoid silently recreating the network unless it is truly missing. This matches the issue’s concern thatupandcreateChannelshould have clearer separation of responsibility.I’d be happy to work on this by first applying the minimal fix for the current regression, and then cleaning up the detection logic so it is less dependent on environment-specific container counts.
test network incorrectly recreates a fabric network when creating a channel
Fix createChannel wrongly recreating an already-running network