弁財天

ゴフマン「専門家を信じるのではなく、自分自身で考えて判断せよ」

Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355, line 3566.

Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355,  line 3521.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355,  line 3522.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355,  line 3523.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_read" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 134,  line 3523.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355,  line 3524.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355,  line 3525.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_read" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 134,  line 3525.
Jun 15 21:50:07 localhost my_sendws.pl[1330]: Mojo::Reactor::Poll: I/O watcher failed: Can't call method "_write" on an undefined value at /usr/share/perl5/vendor_perl/Mojo/UserAgent.pm line 355,  line 3526.

github.com→Mojo::UserAgent: Can't call method "_write" on an undefined value · Issue #1472 · mojolicious/mojo · GitHub

jhthorsen commented on 15 Feb
Doesn't the $ua go out of scope in the code above?
my $ua = Mojo::UserAgent->new;

sub send_ws {
    my ($msg) = @_;
    #my $ua = Mojo::UserAgent->new; # 外に移動w
    #…
}

インド人すっげーw

my $ua = Mojo::UserAgent->new;をローカル変数つかスタックに定義すると、 ローカルブロックが終わって呼び出し元に戻るときにスタック上の変数は解放されているので、 バックグラウンドで走る $ua の参照を使った処理がエラーになっていると思われw

スクリプトの時代なのでシーケンス図を書いて設計したりしないからな…

初期のJavaVMのガーベージコレクタでも似たようなことあったw

投稿されたコメント:

コメント
コメントは無効になっています。