Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

race condition when starting newly created nodes #788

Closed
tiziano88 opened this issue Mar 30, 2020 · 1 comment · Fixed by #789
Closed

race condition when starting newly created nodes #788

tiziano88 opened this issue Mar 30, 2020 · 1 comment · Fixed by #789
Assignees

Comments

@tiziano88
Copy link
Collaborator

in the Rust oak runtime, we start the new node instance before inserting it in the map of running nodes:

// Try starting the node instance first. If this fails, then directly return the error to
// the caller.
instance.start()?;
// If the node was successfully started, insert it in the list of currently running
// nodes.
self.add_running_node(
reference,
Node {
reference,
instance: Some(instance),
label: label.clone(),
handles: Mutex::new(vec![reader].into_iter().collect()),
},
);

this introduces a race between the node instance trying to perform any operation that requires its entry to be present in the runtime (e.g. anything involving labels), and the runtime inserting the instance in its nodes field.

@blaxill @daviddrysdale any idea how to sort this out?

@tiziano88 tiziano88 self-assigned this Mar 30, 2020
tiziano88 added a commit to tiziano88/oak that referenced this issue Mar 30, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes project-oak#788
tiziano88 added a commit to tiziano88/oak that referenced this issue Mar 30, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes project-oak#788
tiziano88 added a commit to tiziano88/oak that referenced this issue Mar 30, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes project-oak#788
tiziano88 added a commit to tiziano88/oak that referenced this issue Mar 30, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes project-oak#788
@blaxill
Copy link
Contributor

blaxill commented Mar 30, 2020

I think your approach in #789 is the way to go: splitting the instances out of Node(Info) already was already starting to make sense for e.g. stopping nodes.

tiziano88 added a commit to tiziano88/oak that referenced this issue Mar 31, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes project-oak#788
tiziano88 added a commit to tiziano88/oak that referenced this issue Mar 31, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes project-oak#788
tiziano88 added a commit that referenced this issue Mar 31, 2020
This also allows to write tests for the newly created
`node_start_instance` function, extracted from `node_create`.

Fixes #788
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants