NPE in 2.1.1

13 views
Skip to first unread message

Jon Nolan

unread,
Oct 28, 2011, 9:04:56 AM10/28/11
to bat...@googlegroups.com
I'm unable to post through the DG for some reason.  I hope this works.

Over the past couple of days we're seeing a lot of these:

java.lang.NullPointerException
at com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWrapper.java:63)
at com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWrapper.java:53)
at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
at com.googlecode.batchfb.impl.PagedLaterAdapter.get(PagedLaterAdapter.java:34)
at com.googlecode.batchfb.impl.PagedLaterAdapter.get(PagedLaterAdapter.java:13)

I haven't had time to debug it yet. My guess is GraphAPI is puking
with a random and newly defined error as it is wont to do and BatchFB
isn't converting it to something useful. I'll look into it later but
if this is a known issue and someone has the info please let me know.

Thanks
Jon

Jeff Schnitzer

unread,
Oct 28, 2011, 1:51:40 PM10/28/11
to bat...@googlegroups.com
It looks like the source material is just providing null.  I checked in a fix for ErrorDetectingWrapper so that it just passes on nulls as-is, but you're still going to hit NPE when PagedLaterAdapter calls getData().

Whatever your original query is, it's returning a null value successfully where it shouldn't.  Or possibly Facebook invented a totally new and unrecognizable kind of error at the top batch level (which of course is not documented).

I just checked in another change, one that logs the batch request and batch response json at FINEST.  So at least you'll be able to see what's going on.  If it's not immediately obvious what's wrong with the response, post it here and I'll look (or email it to me privately if the data is too sensitive).

Jeff

Jon Nolan

unread,
Oct 28, 2011, 3:02:52 PM10/28/11
to bat...@googlegroups.com
Thanks Jeff. I'm diving into it this afternoon. If I determine it's
an edge case BatchFB should consider I'll let you know.

Jon Nolan

unread,
Oct 31, 2011, 8:46:33 AM10/31/11
to bat...@googlegroups.com
This problem is very random and I've yet to repeat it in a controlled
fashion. It happens infrequently on my prod systems and when I check
those connection URLs directly(through BatchFB and directly)
everything works just fine.

I'll have to go with your suggestion and log FINEST on prod. I've
held off on that as it generates massive logs.

Jeff Schnitzer

unread,
Nov 9, 2011, 8:03:05 PM11/9/11
to bat...@googlegroups.com
Just checking in - is this issue still happening, or was it perhaps a
transient FB error?

Jeff

Jon Nolan

unread,
Nov 9, 2011, 8:14:25 PM11/9/11
to bat...@googlegroups.com
Jeff,

I had trouble building batchfb which I haven't done on 2.x (successful
build with no errors but only 57KB, built on another machine and all
was well) . As of Monday we had a build and are deploying the jar
tonight. However, it does seem the errors have dried up. I haven't
seen any at all in a couple of days and that's down from
hundreds/thousands daily. I'm still going to stay on top of it and if
it starts back up turn on the logging.

Thanks,
Jon

Evgeniy Kudlay

unread,
Nov 13, 2011, 5:27:35 PM11/13/11
to BatchFB
Hi, we have problem similar to this. We use batchfb 2.1.1 But we have
NPE when trying to get uid. This problem is very random! Yesterday we
did not see this exception, today we have a lots of this:

java.lang.NullPointerException
at
com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWrapper.java:
63)
at
com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWrapper.java:
53)
at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
at
it.treed.quasar.dreamplanet.facebook.FacebookClient.getUid(FacebookClient.java:
172)

getUid method is:

public long getUid() {
Later<User> me = batcher.graph("me", User.class);
return me.get().getId();
}

Batcher initialasing is:
batcher = new FacebookBatcher(accessToken);

Please help!
> >>> On Fri, Oct 28, 2011 at 11:51 AM, Jeff Schnitzer <j...@infohazard.org> wrote:
> >>>> It looks like the source material is just providing null.  I checked in a
> >>>> fix for ErrorDetectingWrapper so that it just passes on nulls as-is, but
> >>>> you're still going to hit NPE when PagedLaterAdapter calls getData().
> >>>> Whatever your original query is, it's returning a null value successfully
> >>>> where it shouldn't.  Or possibly Facebook invented a totally new and
> >>>> unrecognizable kind of error at the top batch level (which of course is not
> >>>> documented).
> >>>> I just checked in another change, one that logs the batch request and batch
> >>>> response json at FINEST.  So at least you'll be able to see what's going on.
> >>>>  If it's not immediately obvious what's wrong with the response, post it
> >>>> here and I'll look (or email it to me privately if the data is too
> >>>> sensitive).
> >>>> Jeff
>
> >>>> On Fri, Oct 28, 2011 at 6:04 AM, Jon Nolan <j...@lochgarman.com> wrote:
>
> >>>>> I'm unable to post through the DG for some reason.  I hope this works.
>
> >>>>> Over the past couple of days we're seeing a lot of these:
>
> >>>>> java.lang.NullPointerException
> >>>>>        at
> >>>>> com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWra pper.java:63)
> >>>>>        at
> >>>>> com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWra pper.java:53)

Jeff Schnitzer

unread,
Nov 13, 2011, 5:45:14 PM11/13/11
to bat...@googlegroups.com
This is almost certainly the exact same problem.  Facebook broke the batching API :-(

Unfortunately any hack I put in place to fix one of your problems would necessarily break the other; your code expects {} and Jon's code expects [].  This needs to be fixed at Facebook.

Jeff

Evgeniy Kudlay

unread,
Nov 13, 2011, 5:54:21 PM11/13/11
to BatchFB
I actualy do not understand where my code expects {} and Jon's code
expects
[]?

On 14 ноя, 00:45, Jeff Schnitzer <j...@infohazard.org> wrote:
> This is almost certainly the exact same problem.  Facebook broke the
> batching API :-(
>
> Unfortunately any hack I put in place to fix one of your problems would
> necessarily break the other; your code expects {} and Jon's code expects
> [].  This needs to be fixed at Facebook.
>
> Jeff
>
> On Sun, Nov 13, 2011 at 6:27 PM, Evgeniy Kudlay <kudlay.evge...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Hi, we have problem similar to this. We use batchfb 2.1.1 But we have
> > NPE when trying to get uid. This problem is very random! Yesterday we
> > did not see this exception, today we have a lots of this:
>
> > java.lang.NullPointerException
> > at
>
> > com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWra pper.java:
> > 63)
> > at
>
> > com.googlecode.batchfb.impl.ErrorDetectingWrapper.convert(ErrorDetectingWra pper.java:
> > 53)
> > at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
> > at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
> > at com.googlecode.batchfb.util.LaterWrapper.get(LaterWrapper.java:45)
> > at
>
> > it.treed.quasar.dreamplanet.facebook.FacebookClient.getUid(FacebookClient.j ava:

Jeff Schnitzer

unread,
Nov 13, 2011, 6:06:32 PM11/13/11
to bat...@googlegroups.com
I misspoke slightly:

You're mapping to a User class.  Jon is mapping to a Paged structure that looks like this:  { data: [] }.  The hack would involve detecting a null response and faking it into some other structure.  {} would still give NPE to Jon, and { data: [] } would confuse your User class - you'd get an empty User object back.  Neither of these are adequate - let alone satisfying - solutions.

Jeff

Evgeniy Kudlay

unread,
Nov 13, 2011, 6:26:48 PM11/13/11
to BatchFB
As i understand we can not do nothing? :( And it is not clear when the
problem will be solved and will it be solved at all?

On 14 ноя, 01:06, Jeff Schnitzer <j...@infohazard.org> wrote:
> I misspoke slightly:
>
> You're mapping to a User class.  Jon is mapping to a Paged structure that
> looks like this:  { data: [] }.  The hack would involve detecting a null
> response and faking it into some other structure.  {} would still give NPE
> to Jon, and { data: [] } would confuse your User class - you'd get an empty
> User object back.  Neither of these are adequate - let alone satisfying -
> solutions.
>
> Jeff
>

Jeff Schnitzer

unread,
Nov 13, 2011, 7:09:49 PM11/13/11
to bat...@googlegroups.com
I don't know what to say... Facebook broke a major part of their API and there's really nothing I can do about it.  I don't have any private contacts at Facebook.

I can only imagine that this will be fixed soon since there are probably quite a few people using the Batch API.  But this shit happens all the time with Facebook.  They are not a reliable platform.

Subscribe to the issue I created, post nasty messages on stackoverflow, yell at anyone you can.  It's totally unacceptable.

Jeff

Evgeniy Kudlay

unread,
Nov 13, 2011, 7:21:48 PM11/13/11
to BatchFB
Can you give the link to your post on stackoverflow?

On 14 ноя, 02:09, Jeff Schnitzer <j...@infohazard.org> wrote:
> I don't know what to say... Facebook broke a major part of their API and
> there's really nothing I can do about it.  I don't have any private
> contacts at Facebook.
>
> I can only imagine that this will be fixed soon since there are probably
> quite a few people using the Batch API.  But this shit happens all the time
> with Facebook.  They are not a reliable platform.
>
> Subscribe to the issue I created, post nasty messages on stackoverflow,
> yell at anyone you can.  It's totally unacceptable.
>
> Jeff
>

Jeff Schnitzer

unread,
Nov 13, 2011, 7:48:00 PM11/13/11
to bat...@googlegroups.com
I haven't posted one... it was a suggestion.  I actually don't know what the best way to raise the visibility of a major bug like this is.  Make a lot of noise.

Jeff

Jon Nolan

unread,
Nov 14, 2011, 10:07:24 AM11/14/11
to bat...@googlegroups.com
Jeff,

Is a null response ever appropriate? It seems not. I don't know if
my earlier suggestion makes sense but I'd much rather catch a
FacebookException (or subclass) than a NPE. Maybe something like what
you did with PageMigratedException - perhaps
FacebookUtterlyBanjaxedException.

Jon

Jeff Schnitzer

unread,
Nov 14, 2011, 3:12:46 PM11/14/11
to bat...@googlegroups.com
Good point.  I just committed a change which will throw a FacebookException with an nastygram when this issue comes up.

Jeff

Jeff Schnitzer

unread,
Nov 14, 2011, 3:14:47 PM11/14/11
to bat...@googlegroups.com
Would you rather this be a FacebookBrokenException?

Jeff

Jeff Schnitzer

unread,
Nov 14, 2011, 3:19:11 PM11/14/11
to bat...@googlegroups.com
I made it a BrokenFacebookException (keeping with the naming scheme XxFacebookException).

Jeff

Jeff Schnitzer

unread,
Nov 14, 2011, 3:41:18 PM11/14/11
to bat...@googlegroups.com
Facebook of course won't fix their broken shit unless we do all the work for them, so I posted a curl that replicates the issue.  I notice that maybe 1 in 5 requests produces the [null] response.

Evgeniy, are you comfortable building the source from trunk or would you rather I release a 2.1.2 version?

Jeff

Jon Nolan

unread,
Nov 14, 2011, 3:53:57 PM11/14/11
to bat...@googlegroups.com
Thanks Jeff. Yes, I do prefer the BrokenFacebookException.

Jon Nolan

unread,
Nov 14, 2011, 3:56:21 PM11/14/11
to bat...@googlegroups.com
BTW, that one in five you're seeing right now might be one in three
hundred tomorrow. It was really bad a couple of weeks ago, fixed
itself for a solid week and then over the weekend went apeshit again.

Thanks for the patch.

Reply all
Reply to author
Forward
0 new messages