[jira] Created: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12783092#action_12783092 ]

Jacques Le Roux commented on OFBIZ-2208:
----------------------------------------

Hi Adrian,

How do you reproduce in the entity reference screen ? I see nothing special in log.

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786269#action_12786269 ]

Jacques Le Roux commented on OFBIZ-2208:
----------------------------------------

If anybody see a problem with Adrian's patch I will commit it soon...

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux closed OFBIZ-2208.
----------------------------------

       Resolution: Fixed
    Fix Version/s: Release Branch 9.04
         Assignee: Adrian Crum  (was: Jacques Le Roux)

Thanks Adrian,

I have finally commited your patch in trunk at r887916, R9.04 at r887917

I have added some comments in snv log. Here they are

Note: If synchronization proves to slow down sites we could introduce a properties in serverstats.properties to switch from using it or not since I did not remove startTime from the method signature
Then we will use one or the other lines
-            serverHit.set("hitStartDateTime", new java.sql.Timestamp(startTime));
+            serverHit.set("hitStartDateTime", getNowTimestamp());


> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Adrian Crum
>             Fix For: Release Branch 9.04, SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Reopened: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jacques Le Roux reopened OFBIZ-2208:
------------------------------------

      Assignee: Jacques Le Roux  (was: Adrian Crum)

Forgot to reopen this issue: I reverted in trunk at r888111 and in R9.04 at r888113

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 9.04, SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847142#action_12847142 ]

Jacques Le Roux commented on OFBIZ-2208:
----------------------------------------

For the synchronized solution: when you think about it
   new java.sql.Timestamp(System.currentTimeMillis());
give different values, but MySql is unable to store them as different: http://bugs.mysql.com/bug.php?id=8523.

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 9.04, SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847154#action_12847154 ]

Adam Heath commented on OFBIZ-2208:
-----------------------------------

Any solution to this problem that uses a time value for the solution is broken.

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 9.04, SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847274#action_12847274 ]

Jacques Le Roux commented on OFBIZ-2208:
----------------------------------------

Hi Adam,

Have you a suggestion? Maybe we could follow Karim idea but then we would have to create an DB upgrade path. Personnally, as I have currently no needs, I will do it only if a client sponsors it.

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 9.04, SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847401#action_12847401 ]

Adam Heath commented on OFBIZ-2208:
-----------------------------------

The reason why it can't be time based, is that is how it currently is.  And that is what is broken.  The only way to fix this is to use some kind of sequence, maybe not SequenceValue.

> ServerHit aborts transactions when trying to create entries with duplicate startTime(s).
> ----------------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2208
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2208
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, SVN trunk
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: Release Branch 9.04, SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.patch, ServerHitBin.patch, SynchronizedHitBin.patch
>
>
> org.ofbiz.webapp.stats.ServerHitBin.saveHit(...) causes transactions to be aborted due to duplicate PKs.
> The problem is that said method will try to create two or more entries with identical startTimes (i.e. duplicate hitStartDateTime and the other fields composing the PK: visitId, contentId, hitStartDateTime, hitTypeId) if two or more subsequent requests are made in a sufficiently small interval. This can and *will* be the case for example if an application rapidly issues requests for similar data. It would usually not be observed when human users cause requests being issued.
> The cause is that the above mentioned method uses
> serverHit.create();
> to store the entries.
> A solution to this is to _create or update_ an existing entry, thus overwriting an existing entry in case there already was an entry, but more importantly avoiding the actual transaction being aborted. This may not satisfy those who want to record each and every server hit even with equal startTimes. For these cases other approaches might be considered ...
> This is an example where a transaction fails due to saveHit(...). In our case an applet tries to pull data off the server and fails ...
> {panel}Failure in create operation for entity [ServerHit]: org.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:ServerHit][contentId,gdm.getProductFeatureApplAttrs(java.lang.String)][createdStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][createdTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][hitStartDateTime,2009-02-24 10:34:29.443(java.sql.Timestamp)][hitTypeId,REQUEST(java.lang.String)][lastUpdatedStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][lastUpdatedTxStamp,2009-02-24 10:34:29.454(java.sql.Timestamp)][partyId,KR(java.lang.String)][referrerUrl,(java.lang.String)][requestUrl,https://127.0.0.1:8443/gdm/control/getProductFeatureApplAttrs(java.lang.String)][runningTimeMillis,8(java.lang.Long)][serverHostName,Kitty(java.lang.String)][serverIpAddress,192.168.1.70(java.lang.String)][userLoginId,karim(java.lang.String)][visitId,11900(java.lang.String)] (SQL Exception while executing the following:INSERT INTO SERVER_HIT (VISIT_ID, CONTENT_ID, HIT_START_DATE_TIME, HIT_TYPE_ID, NUM_OF_BYTES, RUNNING_TIME_MILLIS, USER_LOGIN_ID, STATUS_ID, REQUEST_URL, REFERRER_URL, SERVER_IP_ADDRESS, SERVER_HOST_NAME, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP, INTERNAL_CONTENT_ID, PARTY_ID, ID_BY_IP_CONTACT_MECH_ID, REF_BY_WEB_CONTACT_MECH_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (Duplicate entry '11900-gdm.getProductFeatureApplAttrs-2009-02-24 10:34:29-REQUEST' for key 'PRIMARY')). Rolling back transaction.
> Exception: org.ofbiz.entity.GenericEntityException{panel}
> This issue seems to be related (it refers to the releae branch 4.0 and the same error shows up):
> [https://issues.apache.org/jira/browse/OFBIZ-2041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

12