PUT attempted on document 'clicks/34921' using a non current etag

1,772 views
Skip to first unread message

Molibar

unread,
Sep 24, 2012, 5:58:46 AM9/24/12
to rav...@googlegroups.com
I get this popping up in my log files:
2012-09-24 04:22:29.7905,Raven.Database.Server.HttpServer,Warn,Error on request,"Raven.Abstractions.Exceptions.ConcurrencyException: PUT attempted on document 'clicks/34921' using a non current etag

As you can see in the attached log file (RavenDBLog.txt) the document with the ID 'clicks/34921' is added multiple times during the same SaveChange, it only happens in the live environment, and not every time.

Sorry for sending such a big part of the RavenDBLog, but I wanted to send everything that happened in that burst of updates.



There are two objects involved, the Visit object, and the Click object (that holds a reference to the Visit object for Map/Reduce reasons):

    public class Visit : IMetaDataHolder
    {
        public string Id { get; set; }
        public MetaData MetaData { get; set; }

        public string Version { get; set; }
        public string MediaSource { get; set; }
        public string Campaign { get; set; }
        public string AdGroup { get; set; }
        public string Keyword { get; set; }

        public string Domain { get; set; }
        public string Page { get; set; }
        public string QueryString { get; set; }

        public string IPAddress { get; set; }
        public string Browser { get; set; }
        public string Referrer { get; set; }
        public string UserAgent { get; set; }
        public bool Secure { get; set; }
        public string AgentBot { get; set; }
        public string SearchPositionString { get; set; }
        public Guid? CustomerGUID { get; set; }
        public bool CookiesDisabled { get; set; }

        public Guid Guid { get; set; }
        public Guid? PreviousGuid { get; set; }
    }



    public class Click : IMetaDataHolder
    {
        public string Id { get; set; }
        public MetaData MetaData { get; set; }

        public Visit Visit { get; set; }
        public string SearchId { get; set; }
        public string ProductCode { get; set; }
        public int ProductScore { get; set; }
    }

The insert is done with a request-wide IDocumentSession supplied by structure map to implement the Unit of Work pattern.


This is just one example of a number of similar problems, in my client it usually looks something like in the ClientLog.txt. Since I always pass on a reference to the Visit object in the other cases too that's where my search is directed now. One is allowed to do this, right? To store objects from other documents in a separate aggregate root document?

Any ideas about what might be the problem?

And what's with the "Collection was modified; enumeration operation may not execute."? I'm not doing anything asynchronous in the requests, so this shouldn't happen, right?


Running RavenDB Server Build 960, and the corresponding client (1.0.960).
ClientLog.txt
RavenDBLog.txt

Oren Eini (Ayende Rahien)

unread,
Sep 24, 2012, 8:21:42 AM9/24/12
to rav...@googlegroups.com
It looks like you have concurrent requests for setting the click.
Probably happens when a user reload the page.

Chris Marisic

unread,
Sep 25, 2012, 11:38:49 AM9/25/12
to rav...@googlegroups.com
Other thoughts would be double clicking on a submit button!

AshokG

unread,
Sep 25, 2012, 11:58:39 AM9/25/12
to rav...@googlegroups.com
Hi, I got the same error just now and immediately googled it hence got it here.

I my case 

1. Just stopped the server
2. deleted all databases including default
3. started server. Hence it created a default database.
4. In a class I had the code to create a tenant database and save a series of 'UserEntity' with Id "UserEntities/1"... till "UserEntities/6".
5. After this I immediately tried launched my prog and started adding a fresh user with empty Id gave this error saying that "UserEntities/1" is already exist.

The question is.. why it is generated Id "UserEntities/1" instead of  "UserEntities/7"  or else some random.

However If I wait for sometime like 10 mins or more the engine is able to generate next or some unique number?

thanks
Ashok

Christer Brännström

unread,
Sep 25, 2012, 12:22:18 PM9/25/12
to rav...@googlegroups.com
To recreate this, wouldn't I have to try to update a Click that was stored with another DocumentSession? I don't read the clicks from Raven in the application, let alone update them. I only create new ones:

_documentSession.Store(new Click(...));
_documentSession.SaveChanges();


The ClickController is really stupid; just inserts, nothing else. The only place the clicks are read is in our reporting application, which doesn't update anything.

To generate the IDs I just use Raven's default behaviour ("clicks/<number>"), no fiddling at all.  

Given that I'm not lying there can't be a concurrency issue in this scenario, and crazy double tapping would just result in a lot of Clicks getting saved, right?

I can of course be wrong in my claims, yet unlikely, I just want to understand this problem. I'm hoping this could be a mess-up in my configuration of the raven server or the client or something.

Regards,
Christer Brannstrom



2012/9/25 Chris Marisic <ch...@marisic.com>

Chris Marisic

unread,
Sep 25, 2012, 12:39:16 PM9/25/12
to rav...@googlegroups.com
Ids are generated using the HiLo algorithim.

If you deleted your databases (all hilo documents are gone), and then inserted those documents with ids manually, it's possible that the session your application has, has the original low value. But this seems like it would be pretty hard to achieve. Unless you have bad session handling and aren't using session per request and instead are using a single session.

greg

unread,
Sep 26, 2012, 5:34:36 AM9/26/12
to rav...@googlegroups.com
This happens if you delete all documents and then recreate them and dont update the hilo for the document type. Update it manually and that should sort your issue out.
Reply all
Reply to author
Forward
0 new messages