I am getting errors for 2-pass-enabled mp4 encoding using drush cron — regardless of the size of the files. The transcoding jobs finish ok using "convert on save" checkbox. In both cases, the jobs produce functional videos, but the 2-pass jobs are not registered correctly with Drupal and endlessly keep re-running. Here are my errors:

# first pass

# watch ls -ltr /tmp
lrwxrwxrwx 1 root   root        30 Nov 12 10:54 mysql.sock -> ../../var/lib/mysql/mysql.sock
drwxrwxrwx 2 user  user     4096 Nov 12 10:54 drupal-video-7M7Vzo
-rw-r--r-- 1 user  user   188416 Nov 12 10:55 1352746455-50a145d779039-multipass-0.log.temp
-rw-r--r-- 1 user  user   454656 Nov 12 10:55 1352746455-50a145d779039-multipass-0.log.mbtree.temp
-rw-r--r-- 1 user  user  8588698 Nov 12 10:55 1352746455-50a145d77886c.mp4

# second pass

# watch ls -ltr /tmp
lrwxrwxrwx 1 root   root        30 Nov 12 10:54 mysql.sock -> ../../var/lib/mysql/mysql.sock
drwxrwxrwx 2 user  user     4096 Nov 12 10:54 drupal-video-7M7Vzo
-rw-r--r-- 1 user  user  1154400 Nov 12 10:56 1352746455-50a145d779039-multipass-0.log.mbtree
-rw-r--r-- 1 user  user   486232 Nov 12 10:56 1352746455-50a145d779039-multipass-0.log
-rw-r--r-- 1 user  user    22106 Nov 12 10:56 1352746455-50a145d77886c.mp4

# job throws this error on exit

<h1>Additional uncaught exception thrown while handling exception.</h1><h2>Original</h2><p>PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT vo.output_fid AS output_fid
FROM
{video_output} vo
WHERE  (original_fid = :db_condition_placeholder_0) ; Array
(
    [:db_condition_placeholder_0] =&amp;gt; 918
)
in Transcoder-&gt;cleanConverted() (line 238 of ~/sites/all/modules/video/includes/Transcoder.inc).</p><h2>Additional</h2><p>PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array
(
    [:db_insert_placeholder_0] =&amp;gt; 0
    [:db_insert_placeholder_1] =&amp;gt; php
    [:db_insert_placeholder_2] =&amp;gt; %type: !message in %function (line %line of %file).
    [:db_insert_placeholder_3] =&amp;gt; a:6:{s:5:&amp;quot;%type&amp;quot;;s:12:&amp;quot;PDOException&amp;quot;;s:8:&amp;quot;!message&amp;quot;;s:232:&amp;quot;SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT vo.output_fid AS output_fid
FROM
{video_output} vo
WHERE  (original_fid = :db_condition_placeholder_0) ; Array
(
    [:db_condition_placeholder_0] =&amp;amp;gt; 918
)
&amp;quot;;s:9:&amp;quot;%function&amp;quot;;s:28:&amp;quot;Transcoder-&amp;gt;cleanConverted()&amp;quot;;s:5:&amp;quot;%file&amp;quot;;s:79:&amp;quot;~/sites/all/modules/video/includes/Transcoder.inc&amp;quot;;s:5:&amp;quot;%line&amp;quot;;i:238;s:14:&amp;quot;severity_level&amp;quot;;i:3;}
    [:db_insert_placeholder_4] =&amp;gt; 3
    [:db_insert_placeholder_5] =&amp;gt;
    [:db_insert_placeholder_6] =&amp;gt; http://default/index.php
    [:db_insert_placeholder_7] =&amp;gt;
    [:db_insert_placeholder_8] =&amp;gt; 127.0.0.1
    [:db_insert_placeholder_9] =&amp;gt; 1352746726
)
in dblog_watchdog() (line 154 of ~/modules/dblog/dblog.module).</p><hr />Drush command terminated abnormally due to an unrecoverable error.                                                                      [error]
Error: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/xhprof.so' -
/usr/local/lib/php/extensions/no-debug-non-zts-20090626/xhprof.so: cannot open shared object file: No such file or directory in Unknown,
line 0
<h1>Uncaught exception thrown in shutdown function.</h1><p>PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {semaphore}
WHERE  (value = :db_condition_placeholder_0) ; Array
(
    [:db_condition_placeholder_0] =&amp;gt; 133564941050a145d6d2b494.60203918
)
in lock_release_all() (line 269 of ~/includes/lock.inc).</p><hr />
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in ~/includes/database/database.inc:2139
Stack trace:
#0 ~/includes/database/database.inc(2139): PDOStatement->execute(Array)
#1 ~/includes/database/database.inc(664): DatabaseStatementBase->execute(Array, Array)
#2 ~/includes/database/database.inc(2318): DatabaseConnection->query('SELECT expire, ...', Array, Array)
#3 ~/includes/lock.inc(167): db_query('SELECT expire, ...', Array)
#4 ~/includes/lock.inc(146): lock_may_be_available('schema:runtime:...')
#5 ~/includes/bootstrap.inc(420): lock_acquire('schema:runtime:...')
#6 ~/includes/bootstrap.inc(442): DrupalCacheArray->set(Array)
#7 [internal function]: DrupalCacheArray->__destruct()
#8 {main}
  thrown in ~/includes/database/database.inc on line 2139

# File is created, but node still shows processed status

This video is currently being processed. Please wait.

# /tmp directory is not cleared from old job remnants

# ls -ltr /tmp
drwxr-xr-x 2 user user    4096 Nov 12 11:29 drush-env
drwxrwxrwx 2 user user    4096 Nov 12 11:29 drupal-video-LK7Cv2
-rw-r--r-- 1 user user 1154400 Nov 12 11:31 1352748543-50a14dffb7a49-multipass-0.log.mbtree

# running "drush cron" starts process over again, and finishes with same errors as above

Comments

michael.k’s picture

Any thoughts on this? I can't use 2-pass at all, and single-pass creates artifacting for blacks in some browsers.

Jorrit’s picture

It looks like there is some timeout in MySQL. Could you raise the wait_timeout setting of MySQL? Could you also try a very small video, one that transcodes in 10 seconds or so?

Also, are you running drush cron as the webserver user?

michael.k’s picture

Thanks for the reply...

I have tried tiny files and get the same result: a job that produces a file but keeps restarting and never converts the node status. And no, I am running drush cron normally, it works for everything else.

Jorrit’s picture

You also get the "MySQL server has gone away" error for small files?

michael.k’s picture

My apologies Jorrit, I must have changed the wait_timeout on a different server. I did change it on the one in question from 200 to 2000. I was able to run the small file that I was sure had previously failed, and I just tested a 2GB file successfully! Black is beautiful again.

By the way, all completed 2-pass jobs leave residual *.multipass-0.log.mbtree files that don't clear from /tmp.

Thanks again for helping to solve problems!

michael.k’s picture

Status:Active» Closed (works as designed)