It seems like lines 167-183 of shorturl_check_availability in shorturl.module are the problem. Not entirely sure why but on node/%nid/edit pages menu_get_item() is hitting the server enough that it's causing "MySQL server has gone away" errors.

I've prepped what I feel might be a good fix for this. I moved the check for shorturl_reserved_tokens() up into shorturl_shorten() so it can't load _shorturl_get_token() and subsequent functions including shorturl_check_availability.

CommentFileSizeAuthor
#1 shorturl.module-876292-1.patch1.1 KBdstol

Comments

dstol’s picture

StatusFileSize
new1.1 KB

Here's the patch.

irakli’s picture

Thanks, David.

I think the logic of the code before and after the patch is not equivalent. Original code was making sure that the generated token does not overlap one of the "reserved" tokens (or an existing alias, or an existing handler further down the code). The intention being - to avoid random generation of unwanted tokens. After the patch you are checking if the original_url contains a reserved token. Not sure what the intention is there, but imho it is not the same as the original purpose.

As for the problem you are experiencing: the piece of code you indicated is calling menu_get_item() and a query against aliases table. Both should be safe to call under any circumstances...

I saw some error messages you sent over, but due to limited scope tbh it was hard to understand whether I was looking at the cause or the effect.

Let me shoot en e-mail to Frank and request his help?

irakli’s picture

Status: Active » Postponed (maintainer needs more info)
dstol’s picture

Yeah that's fine.

+++ shorturl.module	2010-08-06 18:46:51.000000000 -0400
@@ -165,13 +172,6 @@ function _shorturl_get_token($long_url) 
-  $reserved = shorturl_reserved_tokens();
-  
-  foreach ($reserved as $key) {
-    if (stripos($token, $key)!==FALSE) {  // contains reserved word!
-      return FALSE;
-    }
-  }

Perhaps if we refactor this a little.

Powered by Dreditor.

dstol’s picture

Err, d.o is strugging.

irakli’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

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