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

Client hides exceptions that occur further in the pipeline #15

Closed
Altai-man opened this issue Jul 18, 2018 · 6 comments
Closed

Client hides exceptions that occur further in the pipeline #15

Altai-man opened this issue Jul 18, 2018 · 6 comments

Comments

@Altai-man
Copy link
Member

Altai-man commented Jul 18, 2018

See https://stackoverflow.com/questions/51405074/crowebsocketclient-doesnt-work/51408569#51408569

I am not sure immediately where we can fix that, but this has to be fixed.

@Altai-man
Copy link
Member Author

The reason is that web-socket routine-based transformation is not tied with outer supply chain.

@CurtTilmes
Copy link

Found this issue from a search on stackoverflow -- I'm trying to do something dead easy. Just connect to a websocket and print out whatever comes back.

use Cro::WebSocket::Client;

my $uri = 'ws://host:port/blah/blah';

my $conn = await Cro::WebSocket::Client.connect($uri);

react {
    whenever $conn.messages {
        await(.body).print
    }
}

If the server goes down, it just hangs forever.

This Mojo code says "closed" and exits immediately if the server goes down:

use Mojo::UserAgent;

my $uri = 'ws://host:port/blah/blah';

my $ua = Mojo::UserAgent->new;

$ua->websocket($uri => sub {
    my ($ua, $tx) = @_;
    $tx->on(message => sub {
                my ($tx, $msg) = @_;
                print $msg;
            });
    $tx->on(finish => sub {
                say "closed";
            });
});

Mojo::IOLoop->start;

@Altai-man
Copy link
Member Author

Well, that's quite a serious design issue indeed, but it hasn't been decided yet how can we patch it without breaking backward compatibility. Perhaps @jnthn thought on some directions where we can move to?

@Altai-man
Copy link
Member Author

There are at least two different issues here:
1)When exit-ed, Server does not kill its response objects. Thus as WebSocket is implemented as an infinite response to client's bytestream, web-socket blocks continue to go even when the server is dead already.
2)Clients indeed hides the exceptions... Which is a completely different issue.

Started an investigation...

@Altai-man Altai-man changed the title Client sometimes hides exceptions occurred further in pipeline Client hides exceptions that occur further in the pipeline Apr 2, 2019
@Altai-man
Copy link
Member Author

I am splitting the issue... Client exception will be here, zombie server will be in another place.

jnthn added a commit that referenced this issue Jun 28, 2019
This deals with the issue reported in #15.
@Altai-man
Copy link
Member Author

Original issue is tested with b0a142e#diff-682f00620c71b3e986ab48ab169399cbR125 now.
@CurtTilmes issue is tested with b0a142e#diff-682f00620c71b3e986ab48ab169399cbR201 now.

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

No branches or pull requests

2 participants