-
Notifications
You must be signed in to change notification settings - Fork 56
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
Calling finish
, note
etc in task code fails on macOS while communicating over TCP
#97
Comments
Yea, doesn't look like a Minion problem. Maybe a broken |
Oh, running the tests would have been a good idea a week ago. :) I'm strongly suspecting a problem with
Some of the tests fail in the same way I describe, then the test run hangs:
|
Btw. I just ran the tests on macOS without problems in a perlbrew environment. |
Which Postgresql installation do you have and were you connecting to a remote machine? Maybe I should be using a different Postgres binary source. I'm going to compile postgres from source and try everything again. |
Local, Postgres.app 12. |
I compiled Postgres 12.2 myself and recompiled DBD::Pg against it. No problems. Like, something I should have tried a week ago. Thanks for paying attention though. This isn't a problem for me now, but if someone runs into the same situation, at least they can read this. I still learned a lot about Minion by going through the process, so it wasn't a total waste for me. |
I'm collecting info on this issue and I know that this report is incomplete. I'd like to record it here while I'm working on it. I think it's specific to macOS, but that's only a hunch. This might be a DBD::Pg issue rather than a Minion issue, too, but I haven't been able to reproduce it without Minion involved. If you've debugged this sort of thing before, I'd appreciate advice on what else I should investigate.
Darwin otter.local 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64
Steps to reproduce the behavior
When I call a database-mutating method on the job object inside the task code, the subprocess exits with a failure. The parent process recovers and marks the job as failed. Here's the script I'm playing with:
Here's the Pg service, with the hostaddr obscured. Nothing else (psql, other DBD::Pg programs) break using this service.
Now, here's the trick. This same program has no problems running against the same remote Pg server when I run it on an Ubuntu box. This script on the remote machine running against the remote Pg server works just fine.
So, I have another service for a Pg server running on the same laptop. Running this on my MacBook against the local Pg server over TCP fails (job fails because task child exits with an error), but connecting to the local socket works (job finishes normally).
Expected behavior
Calling
finish
,note
, etc on the job object in the task code should not cause the subprocess to exit.Actual behavior
Calling
finish
,note
, etc on the job object in the task code fails somewhere around the code the attempts to make a connection to the database. I tracked the Perl code to a line in DBD::Pg, and this is what I think fails in the child process:https://github.com/bucardo/dbdpg/blob/ef0f61fdcd5d2dec9271c722dac8bd75ce8def6e/Pg.pm#L258
While logging this in postgres, I do not see an attempt to connect (could be wrong, because there are a lot of connection attempts from Minion). I've traced this with
DBI_TRACE=9
, and have those very long logs.I've also traced this with Devel::Trace to watch the Perl path. I think this is the general flow:
Task calls
$job->finish
Minion::Job::finish()
calls$self->minion->backend->finish_job($self->id, $self->retries, $result);
(note
and others have similar calls)Minion::Backend::Pg::finish_job
callsMinion::Backend::Pg::_update
Minion::Backend::Pg::_update
calls$self->pg->db
(Mojo::Pg::Database
) (with an immediate call to->query
, but it never gets that far.Mojo::Pg::Database->db
(Mojo::Pg::db
) callsMojo::Pg::Database->_prepare
, which callsMojo::Pg::Database->_dequeue
, which callsDBI->connect()
. The DBI options at this point seem right, and I thinkAutoInactiveDestroy
is as it should be:{
"AutoCommit" => 1,
"AutoInactiveDestroy" => 1,
"PrintError" => 0,
"PrintWarn" => 0,
"RaiseError" => 1
}
DBI->connect
ends up inDBD::Pg
, particularlyDBD::Pg::db::_login
, which is last Pure perl line of code executed in the child process. Somewhere in there it fails, which leads me to think that it might not be Minion's fault. However, trying to tickle this without Minion hasn't helped. I can't reproduce this by playing withDBD::Pg
without Minion.At this point, the child process exits abnormally without DBI ever connecting. I see that the process gets the
SEGV
signal.The parent process sees the abnormal exit and switches from
finish
tofail
.The text was updated successfully, but these errors were encountered: