Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

hc run ... doesn't allocate a temporary work directory; all agents share one #1338

Open
pjkundert opened this issue Apr 26, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@pjkundert
Copy link
Contributor

Starting multiple agents via hc run ... causes communications failure between the agents, because some communications details are persisted to the directory, and both agents end up using the same persistence directory and using the same communications details.

When running an agent via hc run ..., there are 2 major use cases:

  1. Starting the agent for testing, with intent to discard the resultant source chain and other data
  2. Persisting the source chain and other data between hc runs ... invocations

The default, without specifying options to the contrary, should be to create a temporary directory that contains the source chain and data, which is discarded at the end of execution.

A --persist=<directory> option should be added, to allow the explicit provision of a directory to persist source chain and other necessary data into.

@pjkundert pjkundert added the bug Something isn't working label Apr 26, 2019
@pjkundert
Copy link
Contributor Author

Here's an example of how to invoke hc in such a way that you can run multiple instances; where each instance gets a separate persistence directory: https://github.com/mjbrisebois/holofuel-app/blob/master/Makefile

@pjkundert
Copy link
Contributor Author

pjkundert commented Jun 9, 2019

It appears that the root cause of the problem is that hc uses one NetworkConfig::n3h_persistence_path (see conductor_api/src/config.rs) for all of its data -- except that some of that data is per-agent in nature. Since hc run can be started representing multiple different agents (via the HC_AGENT" environment variable), the per-agent data should use the n3h_persistence_path`, but place the per-agent data in a per-agent sub-directory.

The only option now available to obtain a working hc run with multiple different HC_AGENT=AgentN... configurations, is to also always specify a unique HC_N3H_WORK_DIR=$( mktemp -d ). If you attempt to use hc run with different HC_AGENT=... configurations, you will always experience failures.

@pjkundert
Copy link
Contributor Author

pjkundert commented Jun 10, 2019

Work-in-progress for a temporary (until n3h correctly separates per-agent assets) fix in holochain-rust in branch feature-hc-per-agent-tempdir

@jamesray1
Copy link
Contributor

I think this is still an issue but I think some of the details are out of date here.

[P2-asap]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants