Commit b1f4834
committed
Don't call mysql_close() when InactiveDestroy is set
Without this change, the END block of DBI would call disconnect_all()
and that would call mysql_close() on all open connections. This is bad
because forks would destroy their parent's context on exit as shown in
the example for AutoInactiveDestroy in the DBI docs.
This example fails with "DBD::MariaDB::db do failed: Lost connection to
MySQL server during query" without this fix:
$dbh->{'AutoInactiveDestroy'} = 1;
if (my $pid = fork()) {
waitpid($pid, 0);
$dbh->do('SELECT 1');
} else {
exit(0);
}1 parent d7fbc30 commit b1f4834
1 file changed
+7
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2956 | 2956 | | |
2957 | 2957 | | |
2958 | 2958 | | |
2959 | | - | |
| 2959 | + | |
2960 | 2960 | | |
2961 | 2961 | | |
2962 | 2962 | | |
2963 | | - | |
| 2963 | + | |
| 2964 | + | |
2964 | 2965 | | |
2965 | 2966 | | |
2966 | 2967 | | |
| |||
3021 | 3022 | | |
3022 | 3023 | | |
3023 | 3024 | | |
3024 | | - | |
| 3025 | + | |
3025 | 3026 | | |
3026 | 3027 | | |
3027 | 3028 | | |
| |||
3059 | 3060 | | |
3060 | 3061 | | |
3061 | 3062 | | |
| 3063 | + | |
| 3064 | + | |
3062 | 3065 | | |
3063 | 3066 | | |
3064 | 3067 | | |
| |||
3112 | 3115 | | |
3113 | 3116 | | |
3114 | 3117 | | |
3115 | | - | |
| 3118 | + | |
3116 | 3119 | | |
3117 | 3120 | | |
3118 | 3121 | | |
| |||
0 commit comments