Closed TheBlueMatt closed 4 years ago
Can you try this on nightly?
Once the ICEBreakers-CleanupCrew is announced (which I think will be happening very soon), we should advertise this bug on it (at least the reduction to MCVE part of it); see https://github.com/rust-lang/compiler-team/issues/207
triage: P-high for initial investigation (i.e. identifying actual severity), removing nomination.
@rustbot ping icebreakers-cleanup-crew
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good "Cleanup ICE-breaking candidate". In case it's useful, here are some instructions for tackling these sorts of bugs. Maybe take a look? Thanks! <3
cc @spastorino
Note that when I had a go at building rust-lightning-bitcoinrpc
on my Mac laptop, it failed with this message:
error: cannot find attribute `error` in this scope
--> src/main.rs:253:3
|
253 | #[error("OSX creatively eats your data, using Lightning on OSX is unsafe")]
| ^^^^^
error: aborting due to previous error
error: could not compile `rust-lightning-bitcoinrpc`.
This is due to this line in the source crate:
#[cfg(any(target_os = "macos", target_os = "ios"))]
#[error("OSX creatively eats your data, using Lightning on OSX is unsafe")]
struct ERR {}
So if you are on a Mac laptop, it may or may not be worth your effort to investigate this. (It is probably easy to work around, but I figure I'd let people know up front.)
Oops, right, you'll want to just drop that line. It shouldn't have any other effect, its only there due to (at least previously, based on my super-cursory read) libstd calling regular fsync() on OSX, which historically, well, didn't fsync.
I looked at this a bit more.
I see the ICE on stable and beta.
I do not see the ICE on nightly.
On nightly, I instead get the following error:
Possibly associated: https://github.com/rust-lang/rust/issues/66868 Possibly associated: https://github.com/rust-lang/rust/issues/68382
I am not seeing the ICE in:
rustc 1.41.0 (5e1a79984 2020-01-27)
binary: rustc
commit-hash: 5e1a799842ba6ed4a57e91f7ab9435947482f7d8
commit-date: 2020-01-27
host: x86_64-unknown-linux-gnu
release: 1.41.0
LLVM version: 9.0
rustc 1.42.0-beta.3 (86f329b41 2020-02-07)
binary: rustc
commit-hash: 86f329b419dbac59da59e2ac7d6e21e5eb679ec7
commit-date: 2020-02-07
host: x86_64-unknown-linux-gnu
release: 1.42.0-beta.3
LLVM version: 9.0
rustc 1.43.0-nightly (58b834344 2020-02-05)
binary: rustc
commit-hash: 58b834344fc7b9185e7a50db1ff24e5eb07dae5e
commit-date: 2020-02-05
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0
searched nightlies: from nightly-2019-10-01 to nightly-2019-11-01 regressed nightly: nightly-2019-10-08 searched commits: from https://github.com/rust-lang/rust/commit/421bd77f42c2fe8a2596dbcc1580ec97fb89009f to https://github.com/rust-lang/rust/commit/f3c9cece7b6829e6fd7854a1aee6a1619a81a38c regressed commit: https://github.com/rust-lang/rust/commit/09868a56c95f7bc7b6ee3ab7611e3ca551031dbd source code: https://github.com/TheBlueMatt/rust-lightning-bitcoinrpc/tree/2020-02-ice-demo built against https://github.com/TheBlueMatt/rust-lightning/tree/2020-02-rustc-ice
cargo-bisect-rustc --prompt --start=2019-10-01 --end=2019-11-01
```bash
warning: field is never used: `logger`
--> /home/chris/ext/rust-lightning/lightning/src/chain/chaininterface.rs:303:2
|
303 | logger: Arc
searched nightlies: from nightly-2019-11-01 to nightly-2020-01-31 fixed nightly: nightly-2019-12-08 searched commits: from https://github.com/rust-lang/rust/commit/ae1b871cca56613b1af1a5121dd24ac810ff4b89 to https://github.com/rust-lang/rust/commit/5c5c8eb864e56ce905742b8e97df5506bba6aeef fix commit: https://github.com/rust-lang/rust/commit/41601a8c95240cada94c13466a1fea02e5fe87ed source code: https://github.com/TheBlueMatt/rust-lightning-bitcoinrpc/tree/2020-02-ice-demo built against https://github.com/TheBlueMatt/rust-lightning/tree/2020-02-rustc-ice
Possibly here:
cargo-bisect-rustc --prompt --start=2019-11-01 --end=2020-01-31
Reduced for src/main.rs
in the rust-lightning-bitcoinrpc
crate (still depends on lightning
):
struct RPCClient;
use lightning_net_tokio::Connection;
use tokio::sync::mpsc;
use lightning::ln::{channelmonitor, channelmanager, peer_handler};
use lightning::chain::keysinterface;
use std::sync::Arc;
struct ChannelMonitor;
impl channelmonitor::ManyChannelMonitor for ChannelMonitor {}
#[tokio::main]
async fn main() {
let peer_manager: Arc<peer_handler::PeerManager<lightning_net_tokio::SocketDescriptor, Arc<
channelmanager::ChannelManager<keysinterface::InMemoryChannelKeys, Arc<ChannelMonitor>>
>>> = unimplemented!();
let event_notify: mpsc::Sender<()> = unimplemented!();
let stream: tokio::net::TcpStream = unimplemented!();
let pk: secp256k1::key::PublicKey = unimplemented!();
tokio::spawn(async move {
Connection::setup_outbound(peer_manager, event_notify, pk, stream).await;
});
}
This is happening somewhere in item-bodies checking, if I remove the body of setup_outbound
with unimplemented!()
the error goes away.
Ok, I don't have more time to spend on this, I pushed some deletions to https://github.com/jyn514/rust-lightning/tree/rust-ice-delete
Got it down to two files, but they have to be in different crates: https://github.com/jyn514/rust-lightning-bitcoinrpc/tree/rustc-ice
src/main.rs
:
use lightning_net_tokio::Connection;
#[tokio::main]
async fn main() {
tokio::spawn(async move {
Connection::setup_outbound().await;
});
}
net/src/lib.rs
:
use tokio::net::TcpStream;
use tokio::io::{self, AsyncWriteExt};
use std::sync::{Arc, Mutex};
pub struct Connection {
writer: Option<io::WriteHalf<TcpStream>>,
}
impl Connection {
pub async fn setup_outbound() {
let us: Arc<Mutex<Self>> = unimplemented!();
us.lock().unwrap().writer.as_mut().unwrap().write_all(b"hi").await;
}
}
A little smaller:
src/main.rs
:
use lightning_net_tokio::setup_outbound;
async fn f() {
tokio::spawn(async move {
setup_outbound().await;
});
}
fn main() {}
net/src/lib.rs
:
use tokio::io::{WriteHalf, AsyncWriteExt, Sink};
struct Connection {
writer: WriteHalf<Sink>,
}
pub async fn setup_outbound() {
use std::sync::Mutex;
let us: Mutex<Connection> = unimplemented!();
us.lock().unwrap().writer.write_all(b"").await;
}
This is a duplicate of https://github.com/rust-lang/rust/issues/67893, judging by the error message and the fact that I just confirmed 41601a8c95240cada94c13466a1fea02e5fe87ed as the fixing commit for the reduced example that I created over there. @rustbot modify labels to -E-needs-mcve.
rustc+cargo 1.40.0 Debian testing packages report the following ICE (which does not go away after a cargo clean):
It can be reproduced by trying to build https://github.com/TheBlueMatt/rust-lightning-bitcoinrpc/tree/2020-02-ice-demo against https://github.com/TheBlueMatt/rust-lightning/tree/2020-02-rustc-ice.