Data dropping out?

26 views
Skip to first unread message

KCL

unread,
Sep 11, 2015, 12:52:51 PM9/11/15
to Phirehose Users
Has anyone ever had problems with the first couple of characters dropping out of their JSON stream with Phirehose?  Leveraging a heavily modified version of the Ghetto collect demo.  It was working previously, when I only tracked a single user.  Now that I'm tracking multiple, it seems to be occasionally dropping the initial bracket and the starting quote of "created_at".

Anyone ever see this behavior?  It seems intermittent, too, which leads me to think it might be an issue others have had.



Thanks in advance.


Scott.

wca...@gmail.com

unread,
Sep 11, 2015, 1:50:02 PM9/11/15
to Phirehose Users
Hi Scott,
Sounds like what happened when I started toying with the same thing. 
When the consumer runs it expects to get a end of line character for the fgets with a max of 8KB line length.

If the collector is not writing out the queue files correctly with the expected EndOfLine character it will start to do some funky
looking parses since it doesn't find the end of line character it expects.





My solution.

Some reason on a x64 build (Ubuntu 14.04.3LTS with php 5.5.9) the only thing that it checks against is whatever the native end of line character is.

So to fix the issue make sure to use the php built in constant for the end of line character is via:
PHP_EOL

So the code should now look like this:
fputs($this->getStream(), $status.PHP_EOL);


--Kyle

KCL

unread,
Sep 11, 2015, 4:04:14 PM9/11/15
to Phirehose Users, wca...@gmail.com
That was it!  Thanks so much.  It still belches on multiple tweets in the same file (gives JSON errors) but *THAT* I can deal with.

Kudos!


Scott.
Reply all
Reply to author
Forward
0 new messages