i am running drupal 5.5 MySQL database 5.0.45, PHP 5.1.4, Unicode library PHP Mbstring Extension, Web server Apache, godaddy hosting. whenever i set the site wide block to one of the side bars i get multiple mysql warnings. ive attached the error message because it is really big. i get error messages at the top, center block and bottom of the page. it does this on all pages.

CommentFileSizeAuthor
error message.txt70.4 KBsdierks

Comments

Fr0s7’s picture

Title: massive mysql errors » Massive mysql errors

After enabling the "Weather: system-wide" block, my site hangs for a minute or more (on every page), then I get this same error as well. I was only able to disable the block and get rid of the error by manually editing the database.

Because the queries are returning such big errors, I have a hunch this is a memory issue.

Note: The "Weather: custom user" and "Weather: location of nodes" blocks do not appear at all, regardless of the Location module.

Fr0s7’s picture

Title: Massive mysql errors » Timeout causes mysql errors
Category: support » bug

Diagnosis

The FTP connection to nws.noaa.gov is timing out. The function "file_get_contents()" in weather.module does not handle the error very gracefully, so it gets caught by mysql. This causes other peripheral mysql errors which appear all over the page.

Here's the culprit:

file_get_contents(ftp://tgftp.nws.noaa.gov/data/observations/metar/stations/KMSP.TXT) [function.file-get-contents]: failed to open stream: Connection timed out in /modules/weather/weather.module on line 1481.

Proposed Solution

The _weather_retrieve_data() function which calls file_get_contents() on line 1481 needs better error handling for time-out issues, and/or an alternative to noaa.gov should be found.

Workaround

Retrieving the METAR data using FTP doesn't seem to be working smoothly, due to connection problems. So, just bypass the FTP functions, and use HTTP instead.

  1. Open weather.module in your editor and find the _weather_retrieve_data() function on line 1465. (Note: Note: For some operating systems such as Windows, you will need to temporarily rename the file to something with a recognizable file extension, such as weather_module.php)
  2. Comment-out lines 1476 through 1501. This will skip all FTP attempts and move right along to HTTP.
  3. If necessary, rename your file back to weather.module and upload it back into the modules/weather directory on your site.

This method of data retrieval is slower, but certainly seems more stable.

toddy’s picture

Hi,

thanks a lot for your investigation. However, I think that your workaround should not be necessary, because the module automatically falls back to use HTTP if the FTP connection does not work. This is even saved in the database, so that HTTP will be used upon the next update request.

Regards,
Tobias

toddy’s picture

Assigned: Unassigned » toddy
Status: Active » Closed (fixed)

No more input, thus closing.