OMG

OMG fails to register all trophies

Bug #632485 reported by Tommy Brunn
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OMG
Fix Committed
High
Manish Sinha (मनीष सिन्हा)

Bug Description

OMG seems to only pick up on some of my trophies, for some reason. It seems to be a bit random which ones are recognized, as this time it recognized 7 out of 9, but the last time I tried it recognized 4 out of 9 (some of which weren't recognized this time). The trophies are all generated the same way, so they should all work.

nevon@loltop:~$ ls --width=1 .local/share/omg/trophy/
omgwords-Amateur blogger.trophy
omgwords-Cursed fellow.trophy
omgwords-Grandma.trophy
omgwords-Lucky bastard.trophy
omgwords-Marathon man.trophy
omgwords-Mr Meticulous.trophy
omgwords-Penguin.trophy
omgwords-rPo typits.trophy
omgwords-Threesome.trophy
omgwords-Word junkie.trophy
omgwords-World-class typist.trophy

nevon@loltop:~$ lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require("luomg")
> t = luomg.GetTrophies()
> =#t
7
> for i,v in pairs(t) do
>> print(v.Title)
>> end
Marathon man
Mr Meticulous
World-class typist
Threesome
Cursed fellow
rPo typits
Penguin

Please let me know what other information I can provide you with. I'm using the very latest versions of both omg and luomg.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I will have to look into it.
This problem sounds weird, but will try to replicate.

If I need something else, I will let you know.

Changed in omg:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Tommy,

When do you encounter this problem? When you copy-paste many trophies in ~/.local/share/omg/trophy folder
In yes, then probably it's a synchronization problem. I guess there is an issue of race condition.

Revision history for this message
Tommy Brunn (tommybrunn) wrote :

I don't copy-paste anything in there, but my program generates these 9 achievements one after another in rapid succession, so I would assume the effect is the same as if I was copy-pasting them all in there.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Tommy,

I just wanted to know how the trophies are being registered?

BTW I am trying to fix it assuming it as a race condition

Revision history for this message
Tommy Brunn (tommybrunn) wrote :

You mean how they're generated? Like this: http://paste.ubuntu.com/490433/

Then when I want to register a trophy I just do:
AwardManager:Register(Title, Description, Priority)

Here's an example trophy file: http://pastie.org/1146191

The trophies are all written to ~/.local/share/omg/trophy/ just fine. It's just that OMG only seems to pick up a random selection of them.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I tried my best to re-create the problem. I tried copying 7 trophies via copy-paste, but still OMG! works without any problem and they are saved to the disk without any problem..

I then tried fetching those values via D-Feet debugger and again it still manages to work.

I had 3 trophies initially, then suddenly I dropped 7 trophies. Finally the xml file had 10 trophies.
Here is the OMG! log

manish@KillBox:~/code/omg/OMG/bin/Debug$ mono OMG.exe
Attempting to load the Trophies from the store
Successful in loading trophies from the store
DBus Registered: /org/gnome/omg/trophies
Found the file: /home/manish/.local/share/omg/trophy/Duke-Nukem-Newbie.trophy
Found the file: /home/manish/.local/share/omg/trophy/Facebook-Geek.trophy
Found the file: /home/manish/.local/share/omg/trophy/IRC-Junkie.trophy
Found the file: /home/manish/.local/share/omg/trophy/Launhcpad-Genius.trophy
Found the file: /home/manish/.local/share/omg/trophy/Quake-Newbie.trophy
Found the file: /home/manish/.local/share/omg/trophy/Twitter-Geek.trophy
Found the file: /home/manish/.local/share/omg/trophy/Zeitgeist-Hacker.trophy
Data flushed to store
Data flushed to store
Data flushed to store

When I try to fetch the file via DBus, I am getting all the 10 trophies. Weird. Please try it via D-Feet instead of luomg

Revision history for this message
Tommy Brunn (tommybrunn) wrote :

Tried it yet again, and this time on another computer. There's 13 trophy files in .local/share/omg/trophy/ and yet GetTrophies only returns 9 of them, regardless of whether I use luomg or d-feet. Interestingly enough it also refuses to award me some trophies, even though they are in trophies.xml and are returned by GetTrophies.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I just setup OMG on my laptop. I am still able to get all the trophies. Still not able to find the problem in fetching the trophies.

BTW I faced the race condition. I put all the 10 trophies at once. OMG! picked all 10 of them but saved only the first. Will fix this problem.

I will talk to people in zeitgeist team to try to replicate this problem of getting less trophies than what is actually registered.

Plus I will make the daemon output even more verbose so that you can see where the problem is.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Tommy, one more thing

>>Tried it yet again, and this time on another computer. There's 13 trophy files in .local/share/omg/trophy/ and yet GetTrophies only returns 9 of them, regardless of whether I use luomg or d-feet

Case 1:
You mean to say that even though you have 13 trophies in .local/share/omg/trophy/ and only 9 are returned? You need to check .local/share/omg/trophy/trophies.xml file to see if all 13 are present or not. If more than 9 are present and GetTrophies returns 9, then it is a problem with the API. (Implementation of Fetch)

Case 2:
If there are 13 trophies in .local/share/omg/trophy/ and only 9 of them exist in trophies.xml and 9 of them are returned via GetTrophies then it is a problem with the way Trophies are registered. (Implementation of Registration)

Can you check and tell which problem you facing? Case 1 or Case 2?

Revision history for this message
Tommy Brunn (tommybrunn) wrote :

Sorry for not being clearer. trophies.xml only contains 9 trophies, so we're dealing with case #2 here.

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I can confirm that it is a problem of synchronization (Parsing and saving of trophies should be critical section and only one thread should be allowed to access it)

Even I tried and am able to replicate Case 2.

Thanks Tommy. Will be fixed ASAP

Changed in omg:
assignee: nobody → Manish Sinha (manishsinha)
milestone: none → 0.1
status: Triaged → Confirmed
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I was able to replicate this issue both on my desktop and laptop.

NOw I fixed this issue in commit 62. Please try getting the code, cleaning the trophy folder, deleting the trophies.xml file
Now run omg daemon and register many trophies (say 10-15) and then check the daemon log. It is now even more verbose

Then check the created trophies.xml file. It should contain all the trophies.

I have tried this is on my desktop and laptop both. It fixes the problem.

Please let me know if it fixes the issue.

Changed in omg:
status: Confirmed → In Progress
Revision history for this message
Tommy Brunn (tommybrunn) wrote :

I can confirm that this does indeed solve the problem. All trophies were registered and successfully awarded!

Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

The issue has been fixed.

ATM, there are no show-stopper bugs for release "0.1 inception"

Changed in omg:
status: In Progress → Fix Committed
Changed in omg:
status: Fix Committed → Fix Released
assignee: Manish Sinha (manishsinha) → braulioareis (braulioareis)
Changed in omg:
assignee: braulioareis (braulioareis) → Manish Sinha (manishsinha)
status: Fix Released → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.