cloudy cloudy

Author Topic: Weather34 and 'stale' file  (Read 135 times)

0 Members and 1 Guest are viewing this topic.

Offline Dale Reid

  • Posts: 239
  • Eau Claire, Wisconsin
  • OS/Browser:
  • Win NT 10.0
  • Firefox 65.0
Weather34 and 'stale' file
« on: April 11, 2019, 02:53:30 AM »
I have setup  the Weather34 program as modified to run with WD feeding data.

I will have error messages open on top of the blocks, which read "Warning: file_get_contents(../wdl/clientraw.txt): failed to open stream: Stale file handle in /home/content/45/7755145/html/pwsWD/w34_livedata.php on line 70"

I assumed that the 'stale' data came from clientraw.txt not being uploaded often enough and something in the W34 program checks to see if the data were 'fresh' enough.  I could and probably be wrong with that assumption.

Thinking there was some sort of data freshness counter that looked at when the last clientraw.txt had been uploaded, I went into the Control Panel, and in web files/Real Time Client choices page and set the Delay between uploading data (second) to 20 seconds, dwn from the 30 that was in there.

This was a wild -ss guess, and wonder a) is it clientraw.txt not being updated often enough that would cause this error message?
b) is the delay the right thing to adjust? 
c) What should the delay be set to?
d) anything else that could cause this message or any other places to adjust timing to end this error?

Thx. Dale

Online wvdkuil

  • Wim van der Kuil
  • Posts: 1,066
  • Leuven Belgium CET
  • OS/Browser:
  • iOS 12.0.1
  • Safari 12.0
    • My PWS at Leuven Belgium Europe
Re: Weather34 and 'stale' file
« Reply #1 on: April 11, 2019, 02:58:55 AM »
I have setup  the Weather34 program as modified to run with WD feeding data.

I will have error messages open on top of the blocks, which read "Warning: file_get_contents(../wdl/clientraw.txt): failed to open stream: Stale file handle in /home/content/45/7755145/html/pwsWD/w34_livedata.php on line 70"

. . . shortened . . .
d) anything else that could cause this message or any other places to adjust timing to end this error?

Thx. Dale
Could you please give the URL / link to your site?
I need to check myself what is happening, as this message is new to me.

The most common cause (using https://www.google.com/search?q=PHP+error+Stale+file+handle )
Quote
A filehandle becomes stale whenever the file or directory referenced by the handle is removed by another host, while your client still holds an active reference to the object.

This error occurs even if a file or directory, with the same name, is recreated on the server without the client being aware of it
This occurs as your clientraw is  "moved" on another server, every time a new file is uploaded.
Another server also includes links to the same (your own)  server but addressed with "http . . . /clientraw.txt"
Also check The more difficult questions of easyweathersetup

So we must make sure that the link to your clientraw.txt has the form "../folder/clientraw.txt"   :D
And not "http my server /folder/clientraw.txt"   :oops:

Wim

P.S.  As the first version used full / all error-reporting to iron out the remaining PHP errors,  this warning was shown also. 
But it should have no effect on the correctness of the data, but that is what I want to check using the URL to your site. 
The soon to be released April version has error-reporting switched off by default, it can be switched on to test.
« Last Edit: April 11, 2019, 07:29:32 AM by wvdkuil »

Offline Dale Reid

  • Posts: 239
  • Eau Claire, Wisconsin
  • OS/Browser:
  • Win NT 10.0
  • Firefox 66.0
Re: Weather34 and 'stale' file
« Reply #2 on: April 11, 2019, 12:11:31 PM »
Thank you for the reply, and I should have included the address as part of my first question.

I should have pointed out that I use Firefox to view the data, but at work I have Chrome on the computer and the same error messages appear.  I have never seen them when I view others' implementation of your work.

I also should not that the first display of the page is correct; the error doesn't occur until it has been on screen for awhile.  Further it sometimes, if left on the screen long enough, will disappear and the block under it is visible again.

http://ecwx.info/pwsWD/

Thank you for looking at it, and I hope it is a simple fix or error on my part.

Regards,  Dale

Online wvdkuil

  • Wim van der Kuil
  • Posts: 1,066
  • Leuven Belgium CET
  • OS/Browser:
  • Mac OS X 10.13.6
  • Chrome 73.0.3683.86
    • My PWS at Leuven Belgium Europe
Re: Weather34 and 'stale' file
« Reply #3 on: April 11, 2019, 01:59:35 PM »
. . . shortened . . .
I also should not that the first display of the page is correct; the error doesn't occur until it has been on screen for awhile. 

Further it sometimes, if left on the screen long enough, will disappear and the block under it is visible again.

http://ecwx.info/pwsWD/
. . . shortened . . .

I try to explain, but understand that English is not my native language.
I shortened your message to those two points which describe  the problem.

This warning-message:
1. if error-reporting would be set to normal, the messages would not mess up your display.
2. The scripts try to load a file which is just  being uploaded and those two accesses collide
3. You upload the clientraw.txt using FTP  every 20 seconds
4. The scripts try to load that file every 6-8 seconds on average.
5. Every block has a different waiting time, but sometimes they are queued very close to the FTP happening.
6. FTP is a relatively slow process which also gives a bigger chance of collision.
==> if you wait long enough a collision is certain to happen

The message will disappear
1. The blocks are continually reloaded after so many (3-60) seconds
2. When that block is reloaded again and there is no collision, the message will be replaced with the new data.

"Solutions"
You can "enable WD to upload-as-temp-and-rename clientraw.txt", but I am not familiar on how to do that.
You should consider updating to the April release which will not display unimportant messages
Uploading using FTP every 20 seconds is IMHO to fast,
It seems you are already using the WD-api, consider using that api which uses a fast HTTP upload.

Wim

Offline Dale Reid

  • Posts: 239
  • Eau Claire, Wisconsin
  • OS/Browser:
  • Win NT 10.0
  • Firefox 66.0
Re: Weather34 and 'stale' file
« Reply #4 on: April 11, 2019, 05:52:29 PM »
First, thank you for your reply after analyzing the description I provided.

Your English is VERY good, thank you.

I will wait to see what the April release brings.

You list as a solution using the WD-api upload to convey the information.

I guess I'm not sure how to tell Weather34 to use that information instead of looking to clientraw.txt for the data it needs to display.  Is there a 'how-to-do-this' in an instruction somewhere?  I'd gladly use that if I can figure out how to do so.

And thank you for the nice explanation of why this is happening.  I suspected something similar to this as the cause, but didn't have the skill to figure it out for sure, nor the ways to get over it.

When will the April release be available?
Dale

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 27,948
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 73.0.3683.103
Re: Weather34 and 'stale' file
« Reply #5 on: April 11, 2019, 05:55:26 PM »
When will the April release be available?
Dale

Now  :wink:

Online wvdkuil

  • Wim van der Kuil
  • Posts: 1,066
  • Leuven Belgium CET
  • OS/Browser:
  • Mac OS X 10.13.6
  • Chrome 73.0.3683.86
    • My PWS at Leuven Belgium Europe
Re: Weather34 and 'stale' file
« Reply #6 on: April 11, 2019, 05:58:35 PM »
First, thank you for your reply after analyzing the description I provided.

Your English is VERY good, thank you.
Thanks go to translate.google.com
Quote

I will wait to see what the April release brings.

You list as a solution using the WD-api upload to convey the information.

I guess I'm not sure how to tell Weather34 to use that information instead of looking to clientraw.txt for the data it needs to display.  Is there a 'how-to-do-this' in an instruction somewhere?  I'd gladly use that if I can figure out how to do so.

And thank you for the nice explanation of why this is happening.  I suspected something similar to this as the cause, but didn't have the skill to figure it out for sure, nor the ways to get over it.

When will the April release be available?
Dale
The april release is available now at http://wd34.weather-template.com/
It is a complete replacement, so the easiest way is to rename your current pwsWD to pwsOLD and download and install the new one.

To use the WD-api is in one of the first settings, in the same selection box where you selected clientraw.
See attached screenshot,
Wim

Offline Dale Reid

  • Posts: 239
  • Eau Claire, Wisconsin
  • OS/Browser:
  • Win NT 10.0
  • Firefox 66.0
Re: Weather34 and 'stale' file
« Reply #7 on: April 11, 2019, 09:18:42 PM »
Wim,
New version installed, I told it to use the WDApi and so far there are no issues whatsoever.

Thanks for taking time to assist me.  I've made notes and will follow those in the future.

Dale

 

cumulus