Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Play Services Leak

I started using Google Play Game Services a while ago, and yesterday while checking the logcat I couldnt help to notice this error:

E/DataBuffer(3183): Internal data leak within a DataBuffer object detected! Be sure to explicitly call close() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@40555410)

It occurs several times in a row. Im not exactly sure why it arises. It doesnt make my app crash nor makes the google achievement/leaderboards functionality stop working.

All I know is that it is related to the functions "unlockAchievementImmediate" and "submitScoreImmediate".

Has anybody encountered this problem before or has any suggestions?


Edit: In my app I only use "unlockAchievementImmediate" and "submitScoreImmediate". These functions don't return any buffers that need any closing.

like image 996
cavpollo Avatar asked Feb 11 '14 08:02

cavpollo


People also ask

Is it OK to delete Google Play Services data?

Important: When you clear Google Play Services data or storage, it may delete some information saved to your device, including transit cards, COVID cards, and virtual payment cards saved to Google Pay. See all apps. Scroll down to "Google Play Services." Tap Google Play Services.

Do hackers use Google Play Services?

Unsurprisingly, this has led to a rise in malware that attacks Android smartphones. More surprising is how hackers are getting their malware onto devices. A large study into Android malware found that the number one source of infections was actually the Google Play app store itself.


2 Answers

These items extend DataBuffer: AchievementBuffer, AppStateBuffer, FilteredDataBuffer, GameBuffer, InvitationBuffer, LeaderboardBuffer, LeaderboardScoreBuffer, MetadataBuffer, MomentBuffer, ParticipantBuffer, PersonBuffer, PlayerBuffer, TurnBasedMatchBuffer.

These are generally found in your listeners of those particular items. For example:

public void onTurnBasedMatchesLoaded(int statusCode, LoadMatchesResponse response) 
{
    TurnBasedMatchBuffer buff = response.getMyTurnMatches();
    // do some stuff with buff
    buff.close()
}

public void onPlayersLoaded(int statusCode, PlayerBuffer buff) 
{
    Player p = buff.get(0);
    buff.close();
}

The error doesn't report until after I exit my app and re-enter. If I call up my matches 3 times and exit the app without calling buff.close(), I can expect to see the warning 3 times upon opening it back up again. Add in the buff.close() and they disappear. Voila!

like image 161
CodeMonkey Avatar answered Sep 28 '22 02:09

CodeMonkey


Any SubClass of Data Buffer needs to be released. So after you are done with that object release it.

Data Buffer object contains a release() method so after you are done with that object just release it using databuffer.release();.

like image 36
Abhishek Dewangan Avatar answered Sep 28 '22 04:09

Abhishek Dewangan