PHP Notice: unserialize(): Error at offset in JobQueueDB.php on line 817 (Workaround: Set "job_params" row to type "MEDIUMBLOB" )
Open, NormalPublic

Description

Setup: MW 1.23.9, PHP 5.4.39, MySQL 5.5.43

I am getting the following PHP Notice from "JobQueueDB.php" (e.g. 2 incidents):

PHP Notice:  unserialize(): Error at offset 65494 of 65535 bytes in /.../includes/jobqueue/JobQueueDB.php on line 817

or

PHP Notice:  unserialize(): Error at offset 65535 of 65535 bytes in /.../includes/jobqueue/JobQueueDB.php on line 817
Kghbln created this task.Jun 3 2015, 1:33 PM
Kghbln updated the task description. (Show Details)
Kghbln raised the priority of this task from to Needs Triage.
Kghbln added a project: MediaWiki-JobQueue.
Kghbln added a subscriber: Kghbln.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 3 2015, 1:33 PM
Kghbln triaged this task as Normal priority.Jun 27 2015, 8:08 PM
Kghbln set Security to None.

This means the serialized data blob is invalid.

@Kghbln Do you still experience this issue? If so, could you add somewhere an echo $blob or wfDebug($blob) when unserialize return false and trigger the error to provide us a job sample?

Kghbln lowered the priority of this task from Normal to Low.EditedMay 23 2016, 10:50 PM

@Dereckson It is rarely happening (first time this year just now) and unpredictable when it comes to the wiki throwing the message (choice of 100+)

Thus très désagréable when it comes to debugging :(

Dereckson added a comment.EditedMay 24 2016, 12:06 AM

I sympathize.

In such case, logging could work:

$serializeResult = unserialize( $blob );
if ( $serializeResult === false ) 
{
    file_put_contents( $blob . "\n\n======\n\n", "/tmp/T101257.log", FILE_APPEND );
}

You'll get a log with the wrong blobs, separated by ====== and blank lines.

Kghbln closed this task as Resolved.May 26 2017, 8:22 AM

I did not have this issue in a long time and since I am finally able to move on to MW 1.27 due to the bugs finally fixed for that branch I close this as "Resolved" by some unknown commit since I reported.

RomanSavochenko reopened this task as Open.Mon, Oct 23, 6:26 PM
RomanSavochenko added a subscriber: RomanSavochenko.

I have stable reproduction of the problem which I guess related to somewhere limit in 65536 and if some regular expression is used into unserialize() then it is that one, which I met early and into an other environment.

Then the problem has and observed into the extension "Translate" and for relatively big articles translation.

My environment: MW 1.29.1, PHP 5.6.30, MySQL 5.5.49

Reproduction condition:

  • A page in size more to 65535, translation blocks > 100;
  • Only I mark the page for translation I get messages like to this:

[Mon Oct 23 21:22:00.490844 2017] [:error] [pid 7063] [client 192.168.1.10:51466] PHP Notice: unserialize(): Error at offset 58962 of 65535 bytes in /var/www/oscada/wiki/includes/jobqueue/JobQueueDB.php on line 8
07, referer: http://oscada.org/wiki/Special:LongPages
[Mon Oct 23 21:22:00.491945 2017] [:error] [pid 7063] [client 192.168.1.10:51466] PHP Catchable fatal error: Argument 2 passed to TranslationsUpdateJob::__construct() must be of the type array, boolean given, cal
led in /var/www/oscada/wiki/includes/jobqueue/Job.php on line 74 and defined in /var/www/oscada/wiki/extensions/Translate/tag/TranslationsUpdateJob.php on line 18, referer: http://oscada.org/wiki/Special:LongPages

  • Then the massages are the real problems and I unallowed for translation of the page and more I cannot remove the page at all but the translation removing accorded with like to upper messages.
RomanSavochenko raised the priority of this task from Low to Normal.Mon, Oct 23, 6:29 PM

@RomanSavochenko Thanks a lot for reporting and reopening. Keeping fingers crossed that somebody will deal with this issue.

@RomanSavochenko Thanks a lot for reporting and reopening. Keeping fingers crossed that somebody will deal with this issue.

I hope that also.

Some details after appending the code part:
$serializeResult = unserialize( $blob );
if($serializeResult === false) file_put_contents("/tmp/T101257.log", $blob . "\n\n======\n\n", FILE_APPEND );

Then I have file /tmp/T101257.log which already truncated to size 65545 instead the waiting original file in size 159517.

And more, serialize() is not that one which truncate but after it into makeBlob() I have the full sized file.

So, I have found where the problem from!
Parameters of the jobs truncated by the type "BLOB" of the row "job_params" of the table "job" but it is 2^16 size limit.
Then I set the row "job_params" to the type "MEDIUMBLOB" and have not more for the problem.

Aklapper renamed this task from PHP Notice: unserialize(): Error at offset in JobQueueDB.php on line 817 to PHP Notice: unserialize(): Error at offset in JobQueueDB.php on line 817 (Workaround: Set "job_params" row to type "MEDIUMBLOB" ).Thu, Nov 2, 11:45 AM

Added the Database tag since the workaround or possibly fix involves manipulating the database. Hope this is ok.