fablo icon indicating copy to clipboard operation
fablo copied to clipboard

Fablo recreate fail

Open Lucas1983 opened this issue 2 years ago • 5 comments

Hi,

I'm using Fablo on WSL2 + Docker Desktop. Each time when I try to recreate Fabric network, I get the following error:

Network target directory is empty
Generating network config
    FABLO_VERSION:      1.1.0
    FABLO_CONFIG:       /mnt/d/Workspace/Blockchain/supply-chain-poc/fablo-config.yaml
    FABLO_NETWORK_ROOT: /mnt/d/Workspace/Blockchain/supply-chain-poc/fablo-target
Validation errors count: 0
Validation warnings count: 0

Used network config: /network/workspace/../../network/fablo-config.json
Fabric version is: 2.4.0
Generating docker-compose network 'fablo_network_202302201052'...
   create fabric-config/crypto-config-orderer.yaml
node:internal/fs/utils:345
    throw err;
    ^
Error: ENOENT: no such file or directory, open '/network/workspace/fabric-config/crypto-config-orderer.yaml'
    at Object.openSync (node:fs:591:3)
    at Object.writeFileSync (node:fs:2212:35)
    at write (/fablo/node_modules/mem-fs-editor/lib/actions/commit.js:15:6)
    at DestroyableTransform._transform (/fablo/node_modules/mem-fs-editor/lib/actions/commit.js:49:7)
    at Transform._read (/fablo/node_modules/mem-fs-editor/node_modules/readable-stream/lib/_stream_transform.js:177:10)
    at Transform._write (/fablo/node_modules/mem-fs-editor/node_modules/readable-stream/lib/_stream_transform.js:164:83)
    at doWrite (/fablo/node_modules/mem-fs-editor/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/fablo/node_modules/mem-fs-editor/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/fablo/node_modules/mem-fs-editor/node_modules/readable-stream/lib/_stream_writable.js:307:11)
    at DestroyableTransform.ondata (/fablo/node_modules/yeoman-generator/node_modules/readable-stream/lib/_stream_readable.js:681:20) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/network/workspace/fabric-config/crypto-config-orderer.yaml'
}`
Node.js v18.3.0

After this error, the only way to make Fablo work is to restart Docker Desktop ( I was trying to remove config/target files + reinitialize, remove docker volumes + particular/all images ), but the error still persists.

Lucas1983 avatar Feb 20 '23 12:02 Lucas1983

I observe this error when something goes wrong, and Fablo suddenly exits, leaving one of temporary docker containers running and blocking mounted directories. I guess restarting Docker Desktop works, because it stops also the temporary container and/or unblocks mounted directories. But I'm not sure if it addresses your case.

Does ./fablo prune work correctly? Basically ./fablo recreate calls prune and then up. I guess maybe for WSL2 is too little delay between those two commands to release mounts 🤔 Does ./fablo prune && sleep 5 && ./fablo up work? Or maybe ./fablo prune is not able to release all mounts properly 🤔

dzikowski avatar Feb 20 '23 14:02 dzikowski

./fablo prune seems to work properly ( remove all containers and target folder content - I haven't noticed any "dangling" container after I use this command).
Just tried this one - ./fablo prune && sleep 5 && ./fablo up - didn't help :( But when I unmounted manually from /mnt/wsl/docker-desktop-bind-mounts, only then it starts to work. So it seems that you have the right regarding blocking mounted directories. I'm wondering why after removing volumes from the Docker Desktop, the mounts still last.
Btw. thanks for the tip :)

Lucas1983 avatar Feb 20 '23 18:02 Lucas1983

Is network-target the same or child directory of chaincode source? network-target contains docker compose file with chaincode directory mounted as a volume. So you may end up with a situation, when docker compose mounts its parent directory. I guess this might cause some errors with unmount.

dzikowski avatar Feb 23 '23 08:02 dzikowski

network-target ? did you mean fablo-target ? if so, the answer is no - they are in separate locations. Sorry I can't move chain code to different location (project requirements). Btw. I've tested the same repo code on MacOS - no issue as for now, only on WSL2.

Lucas1983 avatar Apr 13 '23 16:04 Lucas1983

Yes, it should be fablo-target in my previous message. So, if they are in separate locations, I suspect some issues with Docker mounts. But I don't have a solution for that, sorry 😞 Let us know if you find the actual cause, it will help us to improve Fablo.

dzikowski avatar Apr 14 '23 09:04 dzikowski