Error installing packages only when upgrading

Started by -Rock Lee-, April 15, 2022, 10:09:37 PM

Previous topic - Next topic

-Rock Lee-

I'm trying to update a site, I use the converter that is given here in SMF and everything works great... but when I want to install a package it automatically gives me a loop error :(.

( ! ) Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, bool given in /home/Sources/Subs-Db-mysql.php on line 1027

/home/Sources/Errors.php:50:
array (size=14)
  0 =>
    array (size=3)
      'file' => string '/home/Sources/Subs-Db-mysql.php' (length=58)
      'line' => int 590
      'function' => string 'log_error' (length=9)
  1 =>
    array (size=3)
      'file' => string '/home/Sources/Subs-Db-mysql.php' (length=58)
      'line' => int 494
      'function' => string 'smf_db_error' (length=12)
  2 =>
    array (size=3)
      'file' => string '/home/Sources/Errors.php' (length=51)
      'line' => int 138
      'function' => string 'smf_db_query' (length=12)
  3 =>
    array (size=3)
      'file' => string '/home/Sources/Errors.php' (length=51)
      'line' => int 298
      'function' => string 'log_error' (length=9)
  4 =>
    array (size=1)
      'function' => string 'smf_error_handler' (length=17)
  5 =>
    array (size=3)
      'file' => string '/home/Sources/Subs-Db-mysql.php' (length=58)
      'line' => int 1027
      'function' => string 'mysqli_stmt_bind_param' (length=22)
  6 =>
    array (size=3)
      'file' => string '/home/Sources/Errors.php' (length=51)
      'line' => int 129
      'function' => string 'smf_db_error_insert' (length=19)
  7 =>
    array (size=3)
      'file' => string '/home/Sources/Subs-Db-mysql.php' (length=58)
      'line' => int 590
      'function' => string 'log_error' (length=9)
  8 =>
    array (size=3)
      'file' => string '/home/Sources/Subs-Db-mysql.php' (length=58)
      'line' => int 494
      'function' => string 'smf_db_error' (length=12)
  9 =>
    array (size=3)
      'file' => string '/home/Sources/Packages.php' (length=53)
      'line' => int 928
      'function' => string 'smf_db_query' (length=12)
  10 =>
    array (size=3)
      'file' => string '/home/Sources/Subs.php' (length=49)
      'line' => int 6001
      'function' => string 'PackageInstall' (length=14)
  11 =>
    array (size=3)
      'file' => string '/home/Sources/Packages.php' (length=53)
      'line' => int 91
      'function' => string 'call_helper' (length=11)
  12 =>
    array (size=3)
      'file' => string '/home/Sources/Admin.php' (length=50)
      'line' => int 499
      'function' => string 'Packages' (length=8)
  13 =>
    array (size=3)
      'file' => string '/home/index.php' (length=42)
      'line' => int 187
      'function' => string 'AdminMain' (length=9)

Error loop.

Try a clean installation in another directory and everything works as it should, only when I convert from 2.0.19 to 2.1.1 it gives me this problem adding nothing in the SMF error log or in my hosting. I've run out of ideas of what it could be, especially for not generating any error log somehow... by the way the versions used are:

GD version: 2.2.5
ImageMagick Version: 7.1.0-20 Q16-HDRI x86_64 2022-01-22
MySQL Engine: MariaDB
MySQL version: 10.2.43-MariaDB-cll-lve
SQLite3 database based cache: 3.26.0
PHP: 7.4.28 (more detailed)
Server Version: Apache
Database client version: libmysql - 5.6.43


Regards
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Doug Heffernan

Quote from: -Rock Lee- on April 15, 2022, 10:09:37 PMI'm trying to update a site, I use the converter that is given here in SMF

I have to ask, what converter did you use and how did you use it? Because if you are upgrading a forum, you must use the upgrader that is located inside the large upgrade package.

Quote from: -Rock Lee- on April 15, 2022, 10:09:37 PMTry a clean installation in another directory and everything works as it should, only when I convert from 2.0.19 to 2.1.1 it gives me this problem

If mods are installed fine on a fresh 2.1.1. install, but not on the newly converted or upgraded forum, the issue might be that the forum has not been upgraded properly imo.


-Rock Lee-

Wear the package Large upgrade I tried several times and it converted everything with no problems. I can create forums, themes, modify everything... the database doesn't have anything unusual, no extra value. I'll have to try everything file by file to see what I find, although I tried a bit of everything (both what it says here in SMF and github) but the strangest thing was that I didn't get any errors when converting or browsing the entire forum :'(.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

albertlast

Based on the error i guess you got two issue,
first one is that you error log table is broken and second one is visible after you error log get fixed.
please look by using phpmyadmin or similiar tool if you table look like this: https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/other/install_2-1_mysql.sql#L347-L363=

-Rock Lee-

--
-- Table structure for the table `xfg_log_errors`
--

CREATE TABLE `xfg_log_errors` (
  `id_error` mediumint(8) UNSIGNED NOT NULL,
  `log_time` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `id_member` mediumint(8) UNSIGNED NOT NULL DEFAULT 0,
  `ip` char(16) NOT NULL DEFAULT '',
  `url` text NOT NULL,
  `message` text NOT NULL,
  `session` char(32) NOT NULL DEFAULT '',
  `error_type` char(15) NOT NULL DEFAULT 'general',
  `file` varchar(255) NOT NULL DEFAULT '',
  `line` mediumint(8) UNSIGNED NOT NULL DEFAULT 0
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Data dump for table `xfg_log_errors`
--

INSERT INTO `xfg_log_errors` (`id_error`, `log_time`, `id_member`, `ip`, `url`, `message`, `session`, `error_type`, `file`, `line`) VALUES
(1, 1649721722, 0, 'xx.xx.xx.xx', '?action=tpshout;shout=show50;b=1;l=2', '8: Undefined index: cannot_tp_can_shout', '415661232316540', 'undefined_vars', '/home/Sources/Security.php', 910),
--
-- Indexes for dumped tables
--

--
-- table indices `xfg_log_errors`
--
ALTER TABLE `xfg_log_errors`
  ADD PRIMARY KEY (`id_error`),
  ADD KEY `log_time` (`log_time`),
  ADD KEY `id_member` (`id_member`),
  ADD KEY `ip` (`ip`);

--
-- AUTO_INCREMENT of dumped tables
--

--
-- AUTO_INCREMENT of table `xfg_log_errors`
--
ALTER TABLE `xfg_log_errors`
  MODIFY `id_error` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

The structure is the one I left you above if I delete what is next after to "-- Data dump for table `xfg_log_errors`" I can install some mods and it returns to the same. I replace the table directly with another that I create separately with the same prefix, but as before, it randomly installs packages, normally others are slow or it gives me the same error. What confuses me the most is only the one I updated, I tried mysql 8.0.27 thinking it was that but it does the same thing. It must be some bad or corrupt value but since the forum works without problems in 2.0.19 I don't know what could be wrong.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

albertlast

when you compare you see that backtrace column is missing,
when you add this column the real issue should raised up.

Default sql command to add this coulmn would be:
ALTER TABLE xfg_log_errors
ADD COLUMN backtrace varchar(10000) NOT NULL DEFAULT '';

Maybe is ther a issue with myisam.

Doug Heffernan

#6
That table looks like it belongs to Smf 2.0.19.

-Rock Lee-

Quote from: albertlast on April 17, 2022, 02:06:27 AMMaybe is ther a issue with myisam.

I begin to believe that this is happening because just in case I converted the forum again and verifying the table this time if it converts everything properly but it still gives the same problem. It has to be some bad value because installing from cero I can install everything without problems, will it be some configuration causing problems? Although you should delete the used mods (mostly it uses hooks and others don't touch the database).

Quote from: Doug Heffernan on April 17, 2022, 05:40:16 AMThat table looks like it belongs to Smf 2.0.19.

Oh, sorry, it was a bit late and I spent a whole afternoon trying to convert it without success, now I just converted it and it shows it like this:

-- ------------------------------------------------ --------

--
-- Table structure for the `xfg_log_errors` table
--

CREATE TABLE `xfg_log_errors` (
  `id_error` mediumint(8) UNSIGNED NOT NULL,
  `log_time` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `id_member` mediumint(8) UNSIGNED NOT NULL DEFAULT 0,
  `url` text NOT NULL,
  `message` text NOT NULL,
  `session` varchar(128) NOT NULL DEFAULT ' ',
  `error_type` char(15) NOT NULL DEFAULT 'general',
  `file` varchar(255) NOT NULL DEFAULT '',
  `line` mediumint(8) UNSIGNED NOT NULL DEFAULT 0,
  `ip` varbinary(16) DEFAULT NULL,
  `backtrace` varchar(10000) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Indexes for dumped tables
--

--
-- Indexes to the `xfg_log_errors` table
--
ALTER TABLE `xfg_log_errors`
  ADD PRIMARY KEY (`id_error`),
  ADD KEY `log_time` (`log_time`),
  ADD KEY `id_member` (`id_member`),
  ADD KEY `ip` (`ip`);

--
-- AUTO_INCREMENT of dumped tables
--

--
-- AUTO_INCREMENT of the `xfg_log_errors` table
--
ALTER TABLE `xfg_log_errors`
  MODIFY `id_error` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

converting multiple sites with much more modifications and limited providers and didn't give me so much trouble :'(.

When I was still in RC3 or 4 I tried to convert it and I had no problems, although all the attachments they were lost... although it converted as it should but not in the final version, I'm going to see if I look at what changed to see if I notice what it is the problem or indication that generates it.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

albertlast

but the error is still ther, or did the error change?

Doug Heffernan

@-Rock Lee-, can you please try something? Can you install a test forum, better to use a different database for it, and run there the Find and repair errors tool and let us know how it will go.

-Rock Lee-

Quote from: albertlast on April 18, 2022, 01:30:25 AMbut the error is still ther, or did the error change?

Still with the same problem, times out and gives me that error.

Quote from: Doug Heffernan on April 18, 2022, 07:16:56 AM@-Rock Lee-, can you please try something? Can you install a test forum, better to use a different database for it, and run there the Find and repair errors tool and let us know how it will go.

I don't mark anything but I'm going to try just recovering the message and user tables, and replace everything else to see if that solves it. Because in a clean installation everything works, so my host supports it, otherwise I would have the same problem.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Doug Heffernan

#11
Quote from: -Rock Lee- on April 18, 2022, 12:09:17 PMI don't mark anything but I'm going to try just recovering the message and user tables, and replace everything else to see if that solves it. Because in a clean installation everything works, so my host supports it, otherwise I would have the same problem.

You do not need to recover anything. What I meant was to install a test forum, using another database, and see if the error will happen there too or not.

What mods do you have nstalled btw?

Arantor

Here's the thing, a test forum won't actually prove anything; a test fresh install will work just fine like it always does.

The question remains: having now fixed the database structure of the log_errors table, does the original error now behave differently? It had some kind of weird error, then tried to log the error, then blew up because it couldn't log the original error. Since the logging part should now be fixed, we could try to address the original actual problem.

-Rock Lee-

@Doug Heffernan As it says above Arantor in a fresh installation everything worked as it should, randomly noticed a slowness but it installs it. The list of mods:

1.     Lazyload     2.0     [ List Files ] [ Delete ]
2.     SMF 2.0.19 Update     1.0     [ Uninstall ] [ List Files ] [ Delete ]
3.     SMF 2.0.18 Update     1.0     [ List Files ] [ Delete ]
4.     SMF 2.0.11 Update     1.0     [ List Files ] [ Delete ]
5.     Code Highlighting     1.5     [ Uninstall ] [ List Files ] [ Delete ]
6.     hCaptcha for SMF     2.1     [ Uninstall ] [ List Files ] [ Delete ]
7.     SMF 2.0.12 Update 1.0 [ List Files ] [ Delete ]
8.     SMF 2.0.13 Update 1.0 [ List Files ] [ Delete ]
9.     SMF 1.1.21 / 2.0.10 Update 1.0 [ List Files ] [ Delete ]
10.     AMP Project     0.0.1     [ Uninstall ] [ List Files ] [ Delete ]
11.     TinyPortal     2.2.1     [ Uninstall ] [ List Files ] [ Delete ]
12.     SMF 2.0.17 Update     1.0     [ List Files ] [ Delete ]
13.     Topic Solved     1.1.2     [ Uninstall ] [ List Files ] [ Delete ]
14.     @mention members     1.1.3     [ Uninstall ] [ List Files ] [ Delete ]
15.     SEO Sitemap     2.2.1     [ Uninstall ] [ List Files ] [ Delete ]
16.     Global Topics     2.2     [ Uninstall ] [ List Files ] [ Delete ]
17.     SMF 2.0.15 Update     1.0     [ List Files ] [ Delete ]
18.     SMF 2.0.14 Update     1.0     [ List Files ] [ Delete ]
19.     SMF 2.0.16 Update     1.0     [ List Files ] [ Delete ]
20. SMF 1.1.21 / 2.0.10 Update 1.0 [ List Files ] [ Delete ]
21. SMF 1.1.20 / 2.0.9 Update 1.0 [ List Files ] [ Delete ]
22.     List-Unsubscribe     1.2     [ List Files ] [ Delete ]
23.     More Spiders     1.2     [ Uninstall ] [ List Files ] [ Delete ]
24.     SMF 2.0.8 Update     1.0     [ List Files ] [ Delete ]

but at the moment of updating all the modifications are deleted and I think something related should appear in any case if it fails, right?

@Arantor I don't change anything, it just looks as if it is going to install x modification, no matter how simple it is, time runs out and it gives me the error.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Arantor

What error exactly do you get? Still the same one (because it shouldn't give you that error now)?

-Rock Lee-

If the same error "( ! ) Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, bool given in /home/Sources/Subs-Db-mysql.php on line 1027"

and in the server log in error_log:
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP Warning:  mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, bool given in /home/Sources/Subs-Db-mysql.php on line 1027
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP Stack trace:
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   1. {main}() /home/index.php:0
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   2. AdminMain() /home/index.php:187
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   3. Packages() /home/Sources/Admin.php:499
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   4. call_helper() /home/Sources/Packages.php:91
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   5. PackageInstall() /home/Sources/Subs.php:6001
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   6. smf_db_query() /home/Sources/Packages.php:928
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   7. smf_db_error() /home/Sources/Subs-Db-mysql.php:494
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   8. log_error() /home/Sources/Subs-Db-mysql.php:590
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   9. smf_db_error_insert() /home/Sources/Errors.php:129
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  10. mysqli_stmt_bind_param() /home/Sources/Subs-Db-mysql.php:1027
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  11. smf_error_handler() /home/Sources/Subs-Db-mysql.php:1027
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  12. log_error() /home/Sources/Errors.php:298
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  13. smf_db_error_insert() /home/Sources/Errors.php:129
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  14. mysqli_stmt_bind_param() /home/Sources/Subs-Db-mysql.php:1027
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP Warning:  mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, bool given in /home/Sources/Subs-Db-mysql.php on line 1028
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP Stack trace:
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   1. {main}() /home/index.php:0
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   2. AdminMain() /home/index.php:187
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   3. Packages() /home/Sources/Admin.php:499
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   4. call_helper() /home/Sources/Packages.php:91
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   5. PackageInstall() /home/Sources/Subs.php:6001
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   6. smf_db_query() /home/Sources/Packages.php:928
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   7. smf_db_error() /home/Sources/Subs-Db-mysql.php:494
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   8. log_error() /home/Sources/Subs-Db-mysql.php:590
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP   9. smf_db_error_insert() /home/Sources/Errors.php:129
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  10. mysqli_stmt_bind_param() /home/Sources/Subs-Db-mysql.php:1027
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  11. smf_error_handler() /home/Sources/Subs-Db-mysql.php:1027
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  12. log_error() /home/Sources/Errors.php:298
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  13. smf_db_error_insert() /home/Sources/Errors.php:129
[18-Apr-2022 15:23:06 America/Argentina/Buenos_Aires] PHP  14. mysqli_stmt_execute() /home/Sources/Subs-Db-mysql.php:1028

Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Arantor

OK so it's actually nothing to do with the error log table after all.

We're back to our old friend:
$request = $smcFunc['db_query']('', '
SELECT version, themes_installed, db_changes
FROM {db_prefix}log_packages
WHERE package_id = {string:current_package}
AND install_state != {int:not_installed}
ORDER BY time_installed DESC
LIMIT 1',
array(
'not_installed' => 0,
'current_package' => $packageInfo['id'],
)
);

This fails, then the error log collapses. And weirder, it collapses with the same symptom we've seen elsewhere... MySQL has gone away, causing the prepare-to-insert to fail, causing the actual logging to fail, causing an error loop.

So, why does this query fail?

Can you try changing Packages.php around line 920 so it reads:
SELECT `version`, `themes_installed`, `db_changes`
instead of the code it has (just putting ` around the things in the SELECT statement)?

-Rock Lee-

Well now at least it showed me errors that TP was missing certains php call, I was able to install 2 mods and it returned to the same problem. I rechecked the database tables and converted them fine, check from the SMF panel and it tells me everything is fine.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Doug Heffernan

Quote from: -Rock Lee- on April 18, 2022, 07:54:06 PMWell now at least it showed me errors that TP was missing certains php call

What was the exact error message in regard to this?

-Rock Lee-

Quote from: Doug Heffernan on April 19, 2022, 06:18:07 AMWhat was the exact error message in regard to this?

It had nothing related to it, it was simply missing "x" file because I accidentally deleted it. I was testing and noticed that it is not the database itself that is the problem, but rather the call, apparently since it cannot resolve it, it crashes, even in an installation on my PC that has much more power to process the call. I manage to install 2 or 3 mods at most and it crashes again but I can't find the exact code.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Advertisement: