4

Strange problem.

Images on my production site are 100% working at one point (right after getting a refresh from staging), and within a day or two, some images on some pages become broken links.

(Production is updated from staging through mysql database dump/restore).

As I continue to watch this over the course of subsequent days, more pages in production experience this symptom, but the images are always there in staging - never broken.

Here's some data... When viewing the content of a page in the staging environment, an inserted image looks like this (Admin UI - view Source).

...installed one of the Outlook toolbars.</p><p>
[[{\"type\":\"media\",\"view_mode\":\"media_large\",\"fid\":\"123\",\"attributes\":
{\"alt\":\"\",\"class\":\"media-image image-style-large image-style-large image-style-large\",
\"height\":\"298\",\"typeof\":\"foaf:Image\",\"width\":\"264\"}}]]
</p><p><strong>Who can ...

When the Staging content is pushed to Production, viewing the same page in the Admin UI on the production server, the content starts out exactly the same and the image renders fine.

Within a day or two, the Production page changes (presumably by something Drupal Cron is doing) to something like this:

...installed one of the Outlook toolbars.</p><p>
<img alt=\"\" class=\"media-image image-style-large image-style-large image-style-large image-style-large\"
height=\"298\" width=\"264\" typeof=\"foaf:Image\"
src=\"http://default/sites/default/files/styles/large/public/Send%20Securely%20and%20account%20selection.png\" />
</p><p><strong>Who can ...

The "img src" version that creeps in is a bad URL -

http://default/sites/default/....

I've grep'ed my daily mysqldumps for this bad URL string, and each day there are a different number that creep in.

    for file in /data/mysqldumps/*sql
    do
      echo -n $file
      echo -n ": "
      grep -o "http://default" $file | wc -l
    done

/data/mysqldumps/20121205-160101.sql: 0 (Zero occurrences on Dec 5 because I pushed
                                         on that date, & all images were known good)
/data/mysqldumps/20121206-160101.sql: 106
/data/mysqldumps/20121207-160102.sql: 130
/data/mysqldumps/20121208-000101.sql: 138
/data/mysqldumps/20121209-000101.sql: 157
/data/mysqldumps/20121210-000101.sql: 158

No local Admin changes have occurred on production, and nothing but cron is running there.

What can be causing this? It's only happening in production (which is totally awesome).

Any suggestions on troubleshooting?

Thanks, Mark

  • 2
    Do you have $base_url defined in settings.php? – mpdonadio Dec 11 '12 at 21:07
  • In researching further, the entries in the database only appear in these tables: cache_field, cache_metatag, cache_form, watchdog. I've updated base_url, and I'm keeping an eye on it to see if it recurs after that change. – Mark Williams Dec 12 '12 at 19:47
  • I suspect you have something weird going on with fetching pages from localhost. If this appears to do the trick, I will write up what I suspect is happening. – mpdonadio Dec 12 '12 at 19:52
  • The addition of the configuration parameter "$base_url" set to the real name of the site in settings.php has solved this problem. What I still do not understand (from the original problem) is how editing a page in the Admin UI on the production server would show me page content (source) from Cache tables rather than from DB tables where the true "origin" content is. Is that how the editor is really designed? – Mark Williams Dec 14 '12 at 20:41
1

There is a related issue for this here. http://drupal.org/node/1352182.

What's happening is that drupal is storing the URL that is created when the page is first viewed after the cache is cleared. Normally that would be your site url, but sometimes it's not.

In the issue linked you see that some people fixed this using the Pathologic module.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.