Skip to content

lib_stdlib_unix: with_atomic_open_out compatible with different file systems as default

Context

We from marigold have a rollup node running with mondaynet network on our Kubernetes cluster. Seems to work well if don't use docker volumes. When we started to use docker volumes, this error appears:

Apr  8 18:55:59.954 - tx_rollup_node: this node is primarily being developed for testing purposes at the moment
Error:
  Unable to write the configuration file /rollup/config.json

If I created the configuration file manually appears the same error for the store file.

Solution Process

I created a little project to debug the code that creates these files and print the error.

When using a different file system the Unix code error is:

Unix code: Cross-device link

Conclusion

It's used the with_atomic_open_out function to create these files, and this function uses rename syscall, which is not compatible with different file systems.

Solution

Use the function with_open_out instead of with_atomic_open_out for different file systems compatibility.

Change the temp_dir default value to be the same file output directory.

How to test

The easiest way to test it probably is using docker volumes. You can build an image with rollup binaries (only available with PROFILE=dev) or use the image that I build and published for this commit.

docker volume create my-vol
docker run -it -v my-vol:/rollup --entrypoint tezos-tx-rollup-node-alpha ghcr.io/marigold-dev/tezos:dev-b4d7cb2fe223b8459c6e43cabf4b3c06d439d82d-latest --endpoint https://rpc.mondaynet-2022-04-04.teztnets.xyz config init on --data-dir /rollup --operator tz1RgQFV3PqTcicp5b3ASybogo85TkjpS5t2 --rollup-id txr1e86SDAY5J3snTd3dezekvxpDWpobhrf1Q --rollup-genesis BMdFnFbdkjApT9D6BMNFRERSUUsQRs4QQs6k72d6mg8D1ejNyKD --rpc-addr 0.0.0.0:9999 --reconnection-delay 2.0

Result should be something like

Apr 12 15:31:26.379 - tx_rollup_node: this node is primarily being developed for testing purposes at the moment
Configuration written in /rollup/config.json
Apr 12 15:31:26.380 - tx_rollup_node: configuration written in /rollup/config.json
Edited by Felipe Cardozo

Merge request reports