View Full Version : LFSW seems to be sending invalid data
Falcon1
9th September 2008, 22:19
Hi,
a few months ago I started a topic about my "who's online" php script (?action=hosts) stopping to work properly without any changes being made to it and finally I found out what really happens.
The output of the pubstat script sometimes does not conform with the specifications (at least the data that reaches my host).
If you take a look at the file, (it is the output but lfsw) you can see that at the 902nd byte of the file, there is an entry regarding the #^4bia-clan ^8LFS-Racing II server.
Examining this byte to byte, I found out that this entry , having no online racers at the server, is 54 bytes long instead of 53 (32 for the name, 20 for some data and 1 for the number of racers)..
Thus, reading this data messes up the whole process of my script.
(All the previous entries are ok.)
Can someone help?
More importantly, could Victor please take a look at the situation?
Thanks :)
Victor
9th September 2008, 22:23
did you plan to upload that file? Or have I misunderstood? :)
Falcon1
9th September 2008, 22:24
Woops forgot!
Thanks for the instant reply!
Victor
9th September 2008, 22:28
btw, is it always with empty hosts? (ie. consistently?)
Falcon1
9th September 2008, 22:36
It is a bit troublesome to check it every time the problem appears, but in the tests I've run (10 seperate pubstat-output samples on differrent times) it always appeared on empty hosts and on that same #^4bia-clan host...(the test samples are all today's). Note, however, that there are some other times where the whole output is correct..I couldn't narrow down the causes of the problem more than that.
(in case you didn't notice, I edited the first post and uploaded the file :))
Victor
9th September 2008, 22:53
Yeah saw it thanks.
Well I'll put some debugging on that function to see what's happening. I've narrowed it down to either rules or cars being wrong. We'll see soon.
Dygear
10th September 2008, 00:07
Good job on spoting that! Very cool, will watch this topic with bated breath.
Edit: Or bated key strokes.
Victor
10th September 2008, 00:15
btw falcon, let me know if it happens again. I did some rewriting of certain bits - maybe that already helped. But if it still happens, i'll know that those rewrites didn't fix anything.
Dygear
10th September 2008, 00:25
btw falcon, let me know if it happens again. I did some rewriting of certain bits - maybe that already helped. But if it still happens, i'll know that those rewrites didn't fix anything.
I would like to know how your giveing us this data to us on the backend. I would have to think there is use of the php Pack function, SimpleXML class & JSON encode function. So I wonder if it's a problem with your code or the functions or methods that your using.
Victor
10th September 2008, 00:32
Well he used the binary output, so none of the mentioned functions can be it.
Also, in the case of hosts, I store a lot of host related data as binary in the db, so in the above example, it's just a simple $row[0].$row[1].$row[2] etc. to output in binary format.
But in my old days i assigned a bit large variable formats to table columns, allowing for more than 4 bytes (in cases of Cars / TMLT etc). This shouldn't be a problem though, but my theory is that somewhere somehow more than 4 bytes got written in rare cases. How? I've no idea atm. There's just one place in my background LFS stats processor that writes this data and it just can't write more than 4 bytes. Or less for that matter. So I don't know.
But at least I've corrected my db column types now, so the error falcon describes just cannot happen anymore. Unless i was totally off and the error is something else. Highly doubt it though.
Falcon1
10th September 2008, 09:01
Thanks for your help Victor!
Unfortunately, the problem persists and it happens on the same server (#^4bia-clan ^8LFS-Racing II). If i manually correct this entry and move on in the file reading process, other erroneous entries show up too...
Hope I helped :)
Greenseed
10th September 2008, 09:52
Victor, im not sure i fully understand the probleme, since i miss many knowlege, of how all this work! im just starting!(pubstats) just throw out a idea if(Value & 0x80000000) value >>= 1; So you convert from 4Bytes uint to 4Bytes Int. Into another word i can tell something happen here: 0x7FFFFFFF to 0x80000000 , with some php function.
Falcon1
10th September 2008, 11:22
It is weird indeed, to think that a data type surpasses its default length (if not impossible).
However,erroneous entries on the data that my script receives, as said on my first post, are one byte longer than expected.
I am wondering, does this happen to all the pubstat users out there?
Why hasn't anyone else reported any similar problems?
Victor
10th September 2008, 18:13
i use the host output for the forum's user-online indications. But I use version 1.3. Now the second i switch to 1.4 i get the same errors.
The odd thing is though, my pubstat debuggers don't notice anything wrong while on the receiving side there definately is something wrong.
Anyway, I'm homing in on the problem i think. Will figure it out.
Victor
10th September 2008, 18:31
so if all fails it must be the one thing you don't check .. and it is ... it was the country code which was empty for one entry and i didn't check its length.
It doesn't seem to coincide with what the OP states, but it was a bug nevertheless that caused the hostlist to go wrong.
I now have no problems when gathering host & user info for the forum's user-online links.
Falcon please let me know if you still have problems.
Falcon1
10th September 2008, 22:58
Good work Victor!
No problems up to now..If they re-appear, I'll just post here.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.