-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Replace tokio_core
with tokio
(ring
-> 0.13)
#9657
Conversation
It looks like @c0gent signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
Cargo.toml
Outdated
ring = { git = "https://github.com/paritytech/ring" } | ||
# ring = { git = "https://github.com/paritytech/ring" } | ||
ring = { git = "https://github.com/briansmith/ring" } | ||
parity-crypto = { git = "https://github.com/c0gent/parity-common", branch = "ring-0.13" } |
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.
parity-crypto = "0.2"
Cargo.toml
Outdated
@@ -140,4 +140,7 @@ members = [ | |||
] | |||
|
|||
[patch.crates-io] | |||
ring = { git = "https://github.com/paritytech/ring" } | |||
# ring = { git = "https://github.com/paritytech/ring" } | |||
ring = { git = "https://github.com/briansmith/ring" } |
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.
we don't need this
Cargo.toml
Outdated
# ring = { git = "https://github.com/paritytech/ring" } | ||
ring = { git = "https://github.com/briansmith/ring" } | ||
parity-crypto = { git = "https://github.com/c0gent/parity-common", branch = "ring-0.13" } | ||
cid = { git = "https://github.com/c0gent/rust-cid", branch = "bump-multihash" } |
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 pinged the slack of Protocol Labs about multiformats/rust-cid#11
ipfs/src/error.rs
Outdated
} | ||
|
||
impl ::std::error::Error for ServerError { | ||
fn description(&self) -> &str { "ServerError" } |
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.
The methods of the Error
trait are deprecated. Instead, it's the implementation of Display
that should write ServerError
.
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.
Indeed, (and I'm inclined to move errors towards failure
depending on what happens with the new std error trait) but std::error::Error
is required when building a hyper server.
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.
Error
itself is not deprecated, just implementing the methods on it.
You still should write impl Error for ServerError {}
.
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.
Ah, my mistake. It's been a while since I've manually implemented it at all. :)
I thought maybe you were referring to potential future deprecation: rust-lang/rfcs#2504.
@@ -59,7 +59,7 @@ const KEEP_ALIVE_SEND_INTERVAL: Duration = Duration::from_secs(30); | |||
const KEEP_ALIVE_DISCONNECT_INTERVAL: Duration = Duration::from_secs(60); | |||
|
|||
/// Empty future. | |||
pub type BoxedEmptyFuture = Box<Future<Item = (), Error = ()> + Send>; | |||
pub type BoxedEmptyFuture = Box<Future<Item = (), Error = ()> + Send + 'static>; |
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.
Nit: change shouldn't be needed.
|
||
Ok(Arc::new(ClusterCore { | ||
handle: handle, | ||
// executor: executor, |
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.
Commented out code.
} | ||
} | ||
let check_predicate = future::loop_fn((), move|_| { | ||
if predicate() { |
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.
Wrong indentation.
@@ -1119,7 +1117,15 @@ pub mod tests { | |||
use std::time::{Duration, Instant}; | |||
use std::collections::{BTreeSet, VecDeque}; | |||
use parking_lot::Mutex; | |||
use tokio_core::reactor::Core; | |||
use tokio::{ | |||
// reactor::Reactor, |
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.
Commented out code.
pub fn deadline<F, T>(duration: Duration, future: F) -> Result<Deadline<F>, io::Error> | ||
where F: Future<Item = T, Error = io::Error> + Send + 'static, T: Send + 'static | ||
{ | ||
// let timeout: DeadlineBox<F> = Box::new(Timeout::new((), duration)?.map(|_| DeadlineStatus::Timeout)); |
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.
Commented out code.
b4e8e4d
to
bd7d453
Compare
2fe3c98
to
4a49a06
Compare
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.
Good stuff here, I like it! :)
Cargo.toml
Outdated
@@ -31,7 +31,7 @@ futures = "0.1" | |||
futures-cpupool = "0.1" | |||
fdlimit = "0.1" | |||
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" } | |||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" } | |||
jsonrpc-core = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" } |
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.
This will change back to "https://github.com/paritytech/jsonrpc.git"
at some point before the PR lands right?
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.
Absolutely. Currently just waiting on a specific release/branch/tag etc. to depend on (It's probably wise to hold off on that until this PR is confirmed to work properly).
ethcore/stratum/Cargo.toml
Outdated
jsonrpc-tcp-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" } | ||
jsonrpc-core = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" } | ||
jsonrpc-macros = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" } | ||
jsonrpc-tcp-server = { git = "https://github.com/c0gent/jsonrpc.git", branch = "c0gent-hyper" } |
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.
These will change back to "https://github.com/paritytech/jsonrpc.git" at some point before the PR lands right?
rpc/src/tests/ws.rs
Outdated
@@ -34,10 +34,9 @@ pub fn serve() -> (Server<ws::Server>, usize, GuardedAuthCodes) { | |||
let authcodes = GuardedAuthCodes::new(); | |||
let stats = Arc::new(informant::RpcStats::default()); | |||
|
|||
let res = Server::new(|remote| ::start_ws( | |||
let res = Server::new(|_remote| ::start_ws( |
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 just Server::new(|_| …
?
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.
No reason really. I like to label those unused variables just to make it easy to know what's there but I'm happy to change it.
rpc/src/v1/extractors.rs
Outdated
X: core::futures::Future<Item=Option<core::Response>, Error=()> + Send + 'static, | ||
fn on_request<F, X>(&self, request: core::Request, meta: Metadata, process: F) | ||
-> Either<Self::Future, X> | ||
where F: FnOnce(core::Request, Metadata) -> X, |
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.
Funny indentation here.
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'm a funny guy!
@@ -137,7 +137,7 @@ pub struct ClusterConfiguration { | |||
/// Administrator public key. | |||
pub admin_public: Option<Public>, | |||
/// Should key servers set change session should be started when servers set changes. | |||
/// This will only work when servers set is configured using KeyServerSet contract. | |||
/// This will only work when servers set is configured using KeyServerSet contract. |
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.
Double spaces here. Also: s/when servers set is/when the server set is/
/// Handle to the event loop. | ||
handle: Handle, | ||
// /// Handle to the event loop. | ||
// executor: TaskExecutor, |
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.
commented out lines
} | ||
|
||
/// Start listening for incoming connections. | ||
fn listen(handle: &Handle, data: Arc<ClusterData>, listen_address: SocketAddr) -> Result<BoxedEmptyFuture, Error> { | ||
Ok(Box::new(TcpListener::bind(&listen_address, &handle)? | ||
fn listen(data: Arc<ClusterData>, listen_address: SocketAddr) -> Result<BoxedEmptyFuture, Error> { |
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 haven't traced through all the calls but aren't we dropping a few possible errors in this method? Perhaps out of scope for this PR though...
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, the errors are not handled the way I would do it. I've tried not to change too much functionality from the original in this PR in order to keep things as straightforward as possible. I'll make a note to have a look at that in an upcoming 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.
@dvdplm Not sure I got it - all connection-establish (both for incoming && outcoming) related errors are processed in process_connection_result
by tracing? Probably some other errors are dropped? Or do you have idea how to handle these errors in other way? Could you please, elaborate?
I haven't been able to spend time on it but I could still use help from someone more familiar with json_tests to give me some idea of where I might start looking for the reason why those are failing. |
0c9c31a
to
8f087b6
Compare
re-json_tests: @sorpaas are you able to provide a few pointers here? :) |
@c0gent The issue looks like that you updated |
I'm re-running the tests and I have to leave for an appointment. I'll push the changes this afternoon (PST). It will leave two items remaining (see OP), 1.) A jsonrpc tag/branch/release to depend on, 2.) Decide what to do about that test -- this can be deferred to a future PR. |
About the json_tests, as @sorpaas point out, it is a submodule issue (I just run them successfully with your PR).
Plus stratum 'can_push_work' also seem to fail, but mainly when running with other tests (randomly). |
Yup thanks. I'll fix all of that when I get back in a few hrs (hopefully). |
I can't reproduce those CI test failures locally but I'll see if I can get to the bottom of it. It's undoubtedly related to the ungraceful shutdown issue noted above. |
Will merge once last grumbles are addressed |
Cargo.toml
Outdated
fdlimit = "0.1" | ||
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" } | ||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.11" } | ||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", rev = "7a59776" } |
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 branched out jsonrpc now, can you update this to use parity-2.2
branch?
@@ -672,7 +675,7 @@ impl ClusterConnections { | |||
Ok(ClusterConnections { | |||
self_node_id: config.self_key_pair.public().clone(), | |||
key_server_set: config.key_server_set.clone(), | |||
trigger: Mutex::new(trigger), | |||
trigger: RwLock::new(trigger), |
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.
Seems we never do self.trigger.read()
anyway, what's the purpose of this change?
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.
Good point, changed back.
panic!("no result in {:?}", timeout); | ||
} | ||
} | ||
runtime.block_on(Interval::new_interval(Duration::new(0, 1_000_000)) |
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.
Can you just use Duration::from_millis(1)
instaed of specifying nanoseconds?
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.
Not sure why I did that, I usually do use from_millis
.
* Rename and move the `tokio_reactor` crate (`util/reactor`) to `tokio_runtime` (`util/runtime`). * Rename `EventLoop` to `Runtime`. - Rename `EventLoop::spawn` to `Runtime::with_default_thread_count`. - Add the `Runtime::with_thread_count` method. - Rename `Remote` to `Executor`. * Remove uses of `CpuPool` and spawn all tasks via the `Runtime` executor instead. * Other changes related to `CpuPool` removal: - Remove `Reservations::with_pool`. `::new` now takes an `Executor` as an argument. - Remove `SenderReservations::with_pool`. `::new` now takes an `Executor` as an argument.
Should be all addressed. |
@tomusdrw are you ok with this now? if that's the case let's merge it |
Looks good but the tests are failing and some of the failures seems legit. @5chdn is it a known issue or something specific to this PR? |
Failures are unrelated. Thanks, everyone. |
1 similar comment
Failures are unrelated. Thanks, everyone. |
Merged 4x 🤦♂️ |
Changes
Replace
tokio_core
withtokio
.Remove
tokio-core
and replace withtokio
inethcore/stratum
secret_store
util/fetch
util/reactor
Bump hyper to 0.12 in
miner
util/fake-fetch
util/fetch
secret_store
Bump
jsonrpc-***
to 0.9 inparity
ethcore/stratum
ipfs
rpc
rpc_client
whisper
Bump
ring
to 0.13Use a more graceful shutdown process in
secret_store
tests.Convert some mutexes to rwlocks in
secret_store
.Consolidate Tokio Runtime use, remove
CpuPool
.Rename and move the
tokio_reactor
crate (util/reactor
) totokio_runtime
(util/runtime
).Rename
EventLoop
toRuntime
.Rename
EventLoop::spawn
toRuntime::with_default_thread_count
.Add the
Runtime::with_thread_count
method.Rename
Remote
toExecutor
.Remove uses of
CpuPool
and spawn all tasks via theRuntime
executorinstead.
Other changes related to
CpuPool
removal:Remove
Reservations::with_pool
.::new
now takes anExecutor
as an argument.Remove
SenderReservations::with_pool
.::new
now takes anExecutor
as an argument.Still Incomplete
parity-common
(Needs a release, tag, or branch other than master)ring
(unclear if upstream works properly on Android)jsonrpc-***
0.1
. paritytech/jsonrpc#327cid
it_should_not_read_too_much_data_sync
test (
util/fetch/src/client.rs:807
). This can be left alone and deferred to a future PR.secret_store
tests.Related Upcoming TODOs (separate PR)
impl Future
and clean up extra types.secret_store/src/key_server_cluster/cluster.rs
(and elsewhere).it_should_not_read_too_much_data_sync
test (util/fetch/src/client.rs
).Closes #9533
Closes #9722