Closed (fixed)
Project:
Weather
Version:
6.x-5.16
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
10 Nov 2010 at 12:40 UTC
Updated:
20 Dec 2010 at 20:50 UTC
Jump to comment: Most recent file
There is a problem fetching data in HTTP mode (weather_fetch = 'HTTP'). It seems the server (weather.noaa.gov) does not close the connection opened with 'fsockopen'.
According to the PHP documentation (first warning in : http://php.net/manual/en/function.feof.php), the 'feof()' function hangs.
A solution would be to modify the loop:
File: weather.module
Function: _weather_retrieve_data($icao)
while (!feof($handle) && !preg_match("/($icao [0-9]{6}Z .+)/", $response, $matches)) {
$response .= fgets($handle, 1024);
}
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | weather-967646-15.patch | 17.05 KB | toddy |
| #13 | weather-967646.patch | 8.77 KB | mikeytown2 |
| #7 | weather-967646.patch | 7.52 KB | mikeytown2 |
Comments
Comment #1
steinmb commentedThe same goes for 6.x branch. Stoppe my frontpage from ever getting rendered. Had to disable the block until we have a better way handling this.
Comment #2
mikeytown2 commentedSubscribe for 6.x
Comment #3
frost commentedthis brought down 2 of our sites, we had to disable the module
Comment #4
alanburke commentedSubscribe
Comment #5
mikeytown2 commentedWeather should not try to update outside of cron. This was causing our site to freeze while it waited for the weather to download. Going to work on a patch that only updates weather on cron. weather_get_metar will try database or internet; should only be database as this can kill your site if the 3rd party server is not playing nicely; would rather have cron die then not serve pages to actual users.
Comment #6
reaneyk commentedSubscribing. Took down our site as well :(
Comment #7
mikeytown2 commentedNow only updates on cron OR if a new weather station was just added. Added a status report entry for the weather module as well on admin/reports/status.
Comment #8
mikeytown2 commentedComment #9
mikeytown2 commentedComment #10
mikeytown2 commentedtime to go home...
Comment #11
toddy commentedI'm not sure that the cron approach is the correct one. Depending on the cron intervals, you might get seriously outdated and useless weather information (think of a cron run once a day). Therefore, I prefer the module to stay the way it is with regard to downloading new weather data.
Also, the call to feof() described by dbanon is no longer in the 6.x and 7.x versions of the module, so I cannot change that line. It has been changed to call drupal_http_request() in order to allow the module to be run behind a proxy (see #847344: Weather Module, not connecting through a proxy). As I understand, there's no option in D6 to set a timeout on that function, there is however in D7, which I will implement in the module.
So the question is now how to proceed -- there's been a bug open for quite some now for D6 to fix this problem, see #156582: drupal_http_request() should support timeout setting.
Regards,
Tobias
Comment #12
mikeytown2 commentedHow about an option that disables downloading on page load.
Comment #13
mikeytown2 commentedComment #14
mojo6911 commentedHas this been fixed yet for Drupal 6? It has crashed my website recently and I had to switch to a module which I do not like. I would prefer to use this one.
Comment #15
toddy commentedHi,
I've created a fix for this problem. In my opinion, the solution is to use a custom copy of drupal_http_request() and modify it so that it supports a timeout parameter. This has now been done, the timeout is 10 seconds. Moreover, the patch introduces an intelligent download scheduler, which is backported from the D7 branch. The module is then able to reduce the download attempts if they are not successful. Instead of every ten minutes, the download interval is 3, 6, 12, and 24 hours; from then on, once a day.
Please test this patch, if there are no objections, I'll release a new version of weather in the next days.
Regards,
Tobias
Comment #17
mikeytown2 commentedI would tack timeout on at the end of this function. Follow what is being done for the 6.x patch #156582: drupal_http_request() should support timeout setting
Powered by Dreditor.
Also think about update on cron (configurable via gui) and some useful info on the status page. That's what my patch does; u try it yet?
Comment #18
gumdrop commentedIs something being worked out for Drupal 5?
Comment #19
alanburke commentedNot yet for D5
I'd imagine if this proves successful, there's a chance it will be backported
Comment #20
toddy commentedThis bug should be fixed in the recent release of weather, please try it and report any problems you still find.
WRT to a backport for Drupal 5.x: I'm sorry, but I won't backport this for D5. As soon as D7 is released, D5 won't get any security support anymore, so I would urge you to update your site to D6 now. It seems that D7 will be released quite soon.