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

Too casually nested regions / scopes hang #377

Closed
frankmcsherry opened this issue Apr 9, 2021 · 4 comments · Fixed by #378
Closed

Too casually nested regions / scopes hang #377

frankmcsherry opened this issue Apr 9, 2021 · 4 comments · Fixed by #378

Comments

@frankmcsherry
Copy link
Member

frankmcsherry commented Apr 9, 2021

The following program hangs after printing twice, even on a single worker

extern crate timely;

use timely::dataflow::{InputHandle, ProbeHandle};
use timely::dataflow::operators::{Input, Exchange, Inspect, Probe};

use crate::timely::dataflow::Scope;
use crate::timely::dataflow::operators::{Enter, Leave};

fn main() {
    // initializes and runs a timely dataflow.
    timely::execute_from_args(std::env::args(), |worker| {

        let index = worker.index();
        let mut input = InputHandle::new();
        let mut probe = ProbeHandle::new();

        // create a new input, exchange data, and inspect its output
        worker.dataflow(|scope| {
            let data = scope.input_from(&mut input);

            scope.region(|inner| {

                let data = data.enter(inner);
                inner.region(|inner2| data.enter(inner2).leave()).leave()
            })
                .inspect(move |x| println!("worker {}:\thello {}", index, x))
                .probe_with(&mut probe);
        });

        // introduce data and watch!
        for round in 0..10 {
            if index == 0 {
                input.send(round);
            }
            input.advance_to(round + 1);
            while probe.less_than(input.time()) {
                worker.step_or_park(None);
            }
        }
    }).unwrap();
}

It does not hang if a trivial operator is inserted between the inner enter and leave operators.

@Kixiron
Copy link
Contributor

Kixiron commented Apr 9, 2021

I think this could be the issue at play in differential-datalog/#931

@frankmcsherry
Copy link
Member Author

Can you say more about the issue there? I could believe that adding more regions could gum things up for whatever reason is at play here. But, if you have something specific that you were seeing (exactly the same behavior, or .. ?).

@Kixiron
Copy link
Contributor

Kixiron commented Apr 9, 2021

Pretty much the exact same behavior, I'm not really entirely sure what caused it though, my best guesses are me eliminating some scary transmutes to do with scoping or (as a stretch) something to do with the new optimizations I added that allowed not doing trivial operations between enter/leave cycles?

@frankmcsherry
Copy link
Member Author

I think I've found the problem. A scope with no operators .. has nothing that will activate it. A message passing in to and out of it traverses no operators, and causes no activation to happen. This leaves the progress information of the message successfully transiting the scope in limbo, never communicated upwards.

Shouldn't be too hard to fix.

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

Successfully merging a pull request may close this issue.

2 participants