-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Looks good for now. However hypervisor approach will make it hard to implement changing settings such as chain, ports, etc. in parity-as-a library setting. We'd probably have to reimplement this so it does not require process shutdown eventually. This would require careful accounting for any shutdown leaks. AFAIK some of the services currently (IPC/RPC/stratum/whatever) don't cleanup 100% after themselves and may leave a thread hanging or some memory stuck in a pointer loop. This will require quite a bit of work and maybe automated tests that would check that there are no memory/thread/FD leaks. |
@@ -94,5 +100,26 @@ describe('views/Settings/Parity', () => { | |||
expect(instance.store.changeMode).to.have.been.calledWith('dark'); | |||
}); | |||
}); | |||
describe('chain selector', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line before.
describe('@action', () => { | ||
describe('setMode', () => { | ||
it('sets the mode', () => { | ||
store.setMode('offline'); | ||
expect(store.mode).to.equal('offline'); | ||
}); | ||
}); | ||
describe('setChain', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line before.
2 tiny comments, otherwise code looks good. |
[ci:skip]
[ci:skip]
ethcore/src/client/client.rs
Outdated
} | ||
|
||
/// Hypervisor should kill this client. | ||
pub fn exit(&self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this called from? Why not just implement Drop
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit
and restart
are not yet called from anywhere, however, they seem like useful public api to have; i plan on implementing a UI endpoints for them to all the user to kill or restart parity easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how it belongs in Client
, whose role is just to manage and provide blockchain data. Hypervisor stuff being at a higher level would make it a lot simpler to manage different kinds of clients, parity-as-a-library, non-hypervised instances, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove for the present PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess we might want to look into an alternative "hypervisor" IPC endpoint that could host such calls, however in the context of the present PR that would be too much extra baggage.
PostExecutionAction::Restart => PLEASE_RESTART_EXIT_CODE, | ||
PostExecutionAction::Restart(spec_name_override) => { | ||
if let Some(spec_name) = spec_name_override { | ||
set_spec_name_override(spec_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about all other CLI options? Are they not preserved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but that happens as part of the standard hypervisor process. this is specifically handling the instance where the user has altered the chain spec via the UI.
@@ -208,6 +208,22 @@ fn latest_exe_path() -> Option<PathBuf> { | |||
.and_then(|mut f| { let mut exe = String::new(); f.read_to_string(&mut exe).ok().map(|_| updates_path(&exe)) }) | |||
} | |||
|
|||
fn set_spec_name_override(spec_name: String) { | |||
if let Err(e) = File::create(updates_path("spec_name_overide")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a need for a file at all? Can't the hypervisor just pass CLI params to a new process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not introduce --chain=auto
as default setting and just update user_defaults
like we do with pruning
, tracing
and fat_db
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there a need for a file at all? Can't the hypervisor just pass CLI params to a new process?
two reasons:
-
getting data out a child process back to the parent cleanly is non-trivial. i used a return-code thus far but it's no good for information-rich content. i guess we could use std-out but then it wouldn't work properly in all circumstances.
-
this method works well for existing auto-update installations; using the hypervisor to relay information (even if it were easy) would mean everyone manually re-installing before this feature worked, since the hypervisor process is always the most recent manually installed executable.
Why not introduce --chain=auto as default setting and just update user_defaults like we do with pruning, tracing and fat_db?
(I actually implemented it this way originally.) user_defaults
is per-chain, which obv. won't work for the setting of which chain to use. we could use another non-per-chain user-defaults, but then that's a lot of extra baggage for what is really just temporary signalling.
No description provided.