My site has over 150,000 redirects, and trying to load the admin page (/admin/config/search/redirect) results in this error:

<h1>Additional uncaught exception thrown while handling exception.</h1>
<h2>Original</h2>
<p>PDOException: SQLSTATE[08S01]: Communication link failure: 1153 Got a packet bigger than &amp;#039;max_allowed_packet&amp;#039; bytes: SELECT redirect.*
FROM 
{redirect} redirect
WHERE  (rid IN  (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2, 
[...and so on]

Seems like the limit(50) part of the query is being ignored.

CommentFileSizeAuthor
#1 redirect.admin_.inc_.patch1002 bytesderekahmedzai

Comments

derekahmedzai’s picture

StatusFileSize
new1002 bytes

I modified the query in redirect.admin.inc so that it PagerDefault and TableSort came first, which is how it's done in path.admin.inc.
It seems to work fine now.

  // Building the SQL query and load the redirects.
  $query = db_select('redirect', 'r')->extend('PagerDefault')->extend('TableSort');
  $query->addField('r', 'rid');
  $query->condition('r.type', 'redirect');
  $query->addTag('redirect_list');
  $query->addTag('redirect_access');
  redirect_build_filter_query($query, array('source', 'redirect'), $keys);
  $rids = $query->orderByHeader($header)->limit(50)->execute()->fetchCol();
  $redirects = redirect_load_multiple($rids);

Patch attached.

dave reid’s picture

Status: Active » Fixed

Thanks for noticing this. This should now be fixed with the latest commit to Git: http://drupalcode.org/project/redirect.git/commit/84c5f6e

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.