Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kalabro’s picture

Status: Active » Needs review
FileSize
931 bytes
stevector’s picture

Can you provide more details on how to reproduce this bug?

kalabro’s picture

@stevector, try to publish node with long (>127) complex unicode title. In my case, russian titles. Watchdog record won't be saved and node won't be published.

You also can run this code in devel/php to see what happens with long unicode strings passed as link to watchdog:

$unicode_title = str_repeat('ó', 128);
dpm(strlen($unicode_title)); // 256
watchdog('content', 'test', array(), WATCHDOG_NOTICE, $unicode_title);
// You will see "PDOException: in dblog_watchdog() (line 160 of modules/dblog/dblog.module)."

_drupal_shutdown_function() Exception was found only with Xdebug: http://drupalcode.org/project/drupal.git/blob/dce3c77a61d9510dbac6927b60...

kalabro’s picture

Is here enough information about this bug now?

kalabro’s picture

Priority: Normal » Major

Any progress with this issue?
May I provide tests or find more reviewers? This bug looks critical because it breaks module logic without any warning messages.

richard.thomas’s picture

I'm pretty sure this is the core bug logged here https://drupal.org/node/1888592, and not really something workbench_moderation is doing wrong. From my testing the previous patch reduced the problem (I can't find the exact piece of content, I'm getting the error when bulk publishing a few thousand nodes), but it did still happen, my guess is due to the url alias still containing unicode characters.

I think the only way to be sure it won't happen is to use "view" as the link title and avoid the url alias lookup, that way we are guaranteed not to exceed the 255 characters. This also has the benefit of avoiding another issue I noticed while testing this, if the link is >255 characters, dblog will remove the closing tag, which can really break the HTML when viewing the log entry.

richard.thomas’s picture

adam7’s picture

Hello,

This issue occurs when any exception (e.g.: PDOException) is thrown within workbench_moderation_store.

The database ends up such that the node and workbench_moderation_history tables have the status for the node set to 1, whereas the node_revision table has a status of 0.

The problem comes down to this line: (workbench_moderation_moderate())

$query = db_update('node_revision')
      ->condition('nid', $node->nid)
      ->fields(array('status' => 0))
      ->execute();

not running in the same transaction as the db calls made from:

workbench_moderation_store($node)

Thus when there is an exception thrown in workbench_moderation_store, the transaction gets rolled back and the node ends up with the status column set to 1 everywhere but the node_revision table.

I don't have any patch suggestions yet as I am unaware of the full history as to why workbench_moderation_store() is called via a shutdown function and what race conditions were in existence.
But the queries that are run in workbench_moderation_moderate() and workbench_moderation_store() need to be in the same transaction.

hefox’s picture

Status: Needs review » Needs work

Confirming the issue, and needs work based on 8.

Not even getting an errors to screen or syslog, what a confusing bug.

aularon’s picture

Priority: Major » Critical
Issue summary: View changes

I am on drupal 7.28, and having the same problem. As others has commented, the problem boils down to `dblog_watchdog`, I changed line 154 from
'link' => substr($log_entry['link'], 0, 255),
to
'link' => mb_substr($log_entry['link'], 0, 255),

and now things work with no problem.

thtas’s picture

I feel like this is more to do with how this module is publishing content during the shutdown phase, and if anything fails along the way you're left with these "half published" records (as in #8). Fixing how this watchdog log is written may solve this particular issue, but it highlights a bigger problem here (see related issue).

aloneblood’s picture

hi,everybody..
I'm using the 1.4 version and i met the same problem. so i create a new patch for 1.4.

alansaviolobo’s picture

Status: Needs work » Closed (won't fix)

This is not applicable to the 7.x-3.x branch as the code has deleted.