Closed avkhozov closed 9 years ago
Maybe it happens when I use notify from worker via $job->app->pg->pubsub->notify
, but for now I can't create a minimal example.
I've never seen this, so i'm afraid without a test case there is nothing we can do.
I have this error/warning too (If it would change anything).
@Logioniz Only if you can provide a test case.
Application:
#!/usr/bin/env perl
use Mojolicious::Lite;
use Minion;
use Mojo::Pg;
my $pg_uri = 'postgresql://test@/test';
app->plugin(Minion => {Pg => $pg_uri});
helper pg => sub { state $pg = Mojo::Pg->new($pg_uri) };
app->pg->pubsub->listen(test => sub { say app->minion->job($_[1])->info->{result} });
app->minion->add_task(test => sub {
system('/bin/sleep 1');
say 'test';
$_[0]->finish(rand);
$_[0]->app->pg->pubsub->notify(test => $_[0]->id)
});
app->start;
Enqueue tasks:
$ for i in {1..100}; do perl t.pl minion job -e test; done
Run worker and send SIGINT to process:
$ perl t.pl minion worker
test
0.0406342305160585
test
^Ctest
test
^Ctest
test
test
test
0.0460506010770949
^C^Ctest
test
^C^C^C^C^Ctest
test
test
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
0.173964488776143
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
test
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
test
test
test
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
test
Get errors in random order.
@avkhozov Afraid i was still not able to replicate the problem.
I suspect this will make the problem go away, but i'm not sure if it is the correct solution. https://github.com/kraih/mojo-pg/commit/a8dbeab671ec2e4c980637beb3d7627fc74f74f6
Ok, I'm going to test further.
This one is related too, database handles should never be reused after forking. https://github.com/kraih/mojo-pg/commit/0d2333d3ef29c60e67ddaa77f73fa203b49d7de5
@kraih a8dbeab did indeed fix a similar problem for me.
I sometimes get an error
(in cleanup) Can't call method "FETCH" on an undefined value at /home/and/perl5/perlbrew/perls/perl 5.20.0/lib/site_perl/5.20.0/Mojo/Pg.pm line 91, <DATA> line 440 during global destruction.
while using Minion (1.13) and Mojo::Pg (2.01)