jhthorsen / mojo-mysql

Mojolicious and Async MySQL
26 stars 26 forks source link

Make PubSub::DESTROY safer #93

Open andrii-suse opened 11 months ago

andrii-suse commented 11 months ago

This is a variation of #23 , but not the only one possible, thus new issue.

(in cleanup) Can't call method "ping" on an undefined value at /usr/share/perl5/Mojo/mysql.pm line 115 during global destruction. can be shown during global destruction when Minion uses Minion-Backend-mysql and executes $minion->perform_jobs()

Example app can be found in https://github.com/andrii-suse/Minion-Backend-mysql/blob/t_environ/t/lib/environ/mm/source/minion.pl.m4 (save it as minion.pl)

Then do (adjust path to mysql socket and db accordingly in TEST_MYSQL):

export MOJO_PUBSUB_EXPERIMENTAL=1 
export TEST_MYSQL="dbi:mysql:mysql_socket=/opt/project/mm1/ma/.sock;db=mm_test" 
perl -Ilib minion.pl enqueue
perl -Ilib minion.pl enqueue
perl -Ilib minion.pl enqueue
perl -Ilib minion.pl enqueue
perl -Ilib minion.pl shoot

It may require several iterations to see the message What is tricky is that I can easily reproduce the problem on openSUSE Tumbleweed and latest debian containers, but never in openSUSE Leap container

Below is link to PR for Minion-Backend-mysql with CI jobs which check the same using environ framework to manage MariaDB server. The PR shows failures on Tumbleweed and Debian, but success on Leap (need be logged in to github to see the logs): https://github.com/andrii-suse/Minion-Backend-mysql/pull/1

jhthorsen commented 10 months ago

I don't mind bailing out on GLOBAL_DESTRUCT. PR is very much welcome 👍