tokio-rs / tokio-core

I/O primitives and event loop for async I/O in Rust
Apache License 2.0
640 stars 115 forks source link

Updating from 0.1.12 to 0.1.14 breaks code #310

Closed ParadoxSpiral closed 6 years ago

ParadoxSpiral commented 6 years ago

Hi, I haven't investigated this much yet, but running a cargo update that does the following breaks my code (I've already determined that the serde/synapse-rpc updates are not at fault):

    Updating registry `https://github.com/rust-lang/crates.io-index`
      Adding arrayvec v0.4.7
    Updating cc v1.0.5 -> v1.0.6
      Adding crossbeam-deque v0.3.0
      Adding crossbeam-epoch v0.4.0
      Adding crossbeam-utils v0.2.2
      Adding memoffset v0.2.1
      Adding nodrop v0.1.12
      Adding scopeguard v0.3.3
    Updating serde v1.0.28 -> v1.0.29
    Updating serde_derive v1.0.28 -> v1.0.29
    Updating syn v0.12.13 -> v0.12.14
    Updating synapse-rpc v0.1.9 -> v0.1.10
      Adding tokio v0.1.3
    Updating tokio-core v0.1.12 -> v0.1.14
      Adding tokio-executor v0.1.0
    Updating tokio-io v0.1.5 -> v0.1.6
      Adding tokio-reactor v0.1.0
      Adding tokio-threadpool v0.1.0

To repro:

The relevant code is this Anyone got an idea of what might have happened here?

carllerche commented 6 years ago

Thanks for the report. I was not able to reproduce the issue locally on OS X. Would you mind providing a bit more info on the environment?

carllerche commented 6 years ago

Also, is there a way to repro w/o the terminal UI? Maybe that is what is tripping me up.

ParadoxSpiral commented 6 years ago

Here's a video of the behaviour, first how it should be, then what happens after an update. Note that eventually (after the timeout of 10 seconds) axon does get notified that it was connected, but does not receive any RPC messages (the list of torrents/trackers is empty). and only occasionally receives messages (via tokio streams implemented by rust-websocket) at the very start.

carllerche commented 6 years ago

Here is the problem: https://github.com/ParadoxSpiral/axon/blob/master/src/rpc.rs#L61-L62

It is not safe to use Core instances across threads. It just happened to work to date by luck.

ParadoxSpiral commented 6 years ago

Oh, well then, sorry for the noise I guess :<