SMF 2.1 upgrade from 2.0.19 bug solved by a trick

Started by Liviu Lalescu, February 11, 2022, 08:16:51 AM

Previous topic - Next topic

Liviu Lalescu

Dear SMF team,

Thank you for the upgrade to 2.1.0 official!

In the past I had a complicated anti-spam verification question, quote: "EN  Write below the name of our timetabling software (Hint: 3 letters.):
AR  اكتب أدناه اسم برنامج الجدولة الزمنية لدينا (تلميح: 3 أحرف.):
DE  Geben Sie den Namen unserer Stundenplanungssoftware an (Tipp: 3 Buchstaben):
EL  Γράψτε παρακάτω το όνομα του λογισμικού μας το οποίο καταρτίζει ωρολόγια προγράμματα (Υπόδειξη: 3 γράμματα.):
ES  Escriba, a continuación, el nombre de nuestro software de generación de horarios (Pista: use 3 letras):
FR  Écrivez ci-dessous le nom de notre logiciel de planification (Indice : 3 lettres.):
PT-BR  Escreva abaixo o nome do nosso software de horários (Dica: são 3 letras.):
RO  Scrieți mai jos numele programului nostru de orare (Indicație: 3 litere.)", with the answer "fet".

In the upgrader, when arriving at converting this portion of SQL database, server did not respond for 30 seconds, even after "Try again". So I commented out the conversion of this old verification question in upgrade_2-1_mysql.sql. Hurray, it solved, after clicking "Try again", but it is a nasty possible bug and others might now know what to do.


What *exactly* did you comment out? The old 2.0 Q&A shared with other tables, relating to moderation reports which might now be broken.
Holder of controversial views, all of which my own.

Aleksi "Lex" Kilpinen

Also, the 30 second notice is more of a warning than an error - it can simply solve itself if you just wait longer.
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF


Quote from: Aleksi "Lex" Kilpinen on February 11, 2022, 09:12:20 AMAlso, the 30 second notice is more of a warning than an error - it can simply solve itself if you just wait longer.

More specifically in many cases it will do exactly that and the query in question probably completed normally in the time it took to identify something and comment it out.

But the odds of this being the correct outcome are slim, very slim. I certainly wouldn't attempt that as my first port of call in such an upgrade - and I've worked on the upgrade script over the years...
Holder of controversial views, all of which my own.

Liviu Lalescu

I am so sorry to reply so late, but I was not notified by email, even if I thought so.

I commented out the lines 1826 to 1851 in upgrade_2-1_mysql.sql.

I had only two moderation posts, I hope it is not broken. The forum works well.

It was surely not going to work without this trick. I waited much.


No, it's not about moderated posts, but the discussions about reported posts that live in the same table.

If you only had a single question, the question wouldn't have been the slow part, because that's just a simple case of finding the one related row it had, and inserting that into the new table. Then deleting it.

Which implies something else was going on with that, like if you had a really really large table with reported posts in it.

This code hasn't changed since we originally wrote it 8 years ago...
Holder of controversial views, all of which my own.

Liviu Lalescu

I had surely less than 10-20 reports to moderator since I installed the forum.

I suspect that my verification question is (was) very long and containing special characters. Now I splitted it for each language, as SMF-2.1 permits this. The upgrade stopped at this part (cannot remember exactly the message, but I think it was about "converting verification questions").


I assure you this isn't a problem for the code as written... I helped write the 2.1 Q&A feature.

And again, it's not the reported posts themselves but the comments table for it. The size of the log_comments table is the relevant thing here.

The length of it is literally a single row, and if it timed out fetching one row that would imply the table is otherwise large.

Alternatively it hit the 30 second execution timeout in hosting just as it got to that step and didn't autocontinue correctly.

Commenting the step out should never be the answer, and if it worked for you it's almost certainly coincidental.
Holder of controversial views, all of which my own.

Liviu Lalescu

I am sorry.

I just copied the log_comments from the SQL. That part has 2850 bytes. I can send it to you privately if you want to take a look. The table has 5 rows.


That's not enough to cause a timeout, certainly not one that commenting out the SQL would fix.

Which means what happened is that the page took 30 seconds to run (doing the previous steps), ran out of time and didn't get to issue the continue instruction correctly, meaning that commenting it out really was coincidence that it solved your immediate problem... refreshing the page would have worked as well.
Holder of controversial views, all of which my own.

Liviu Lalescu

I tried about 5 times the "Try again", leaving about 10 minutes for it, to no avail. Then the trick worked instantaneously.