[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] Created: (OFBIZ-2208) ServerHit aborts transactions when trying to create entries with duplicate startTime(s).

Nicolas Malin (Jira)
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: SVN trunk, Release Branch 4.0
         Environment: any
            Reporter: Karim Rahimpur
             Fix For: SVN trunk


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] Updated: (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:all-tabpanel ]

Karim Rahimpur updated OFBIZ-2208:
----------------------------------

    Attachment: ServerHitBin.java.patch

Changes ServerHitBin.saveHit(...) to use create or store instead of create thus giving an alternate approach to the problem mentioned. As said, multiple requests with same PKs would only create one ServerHit entry but this will not make the transaction fail.

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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=12677716#action_12677716 ]

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

If I remember well this (transactions with the same Timestamp) should not arise if you are using PostGres or Derby but could happen with MySql. This is because Postgres and Derby have milliseconds in Timestamps but [not MySql|http://feedblog.org/2007/05/26/why-doesnt-mysql-support-millisecond-datetime-resolution/]. Moreover, IIRW, OFBiz is enforcing this to be sure to not have duplicates in milliseconds.

There has been [such a question 2 years ago|http://markmail.org/message/vqgcqdk7hnsjp3eo] but w/o a clear answer.

On my side I think your solution is a good one as we don't have to worry too much for ServerHit duplicates. Moreover, this problem should only happen with MySql hence this change should not have any impact for DBMS using milliseconds in Timestamps. So if nobody sees a problem with that I will commit this solution very 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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] Assigned: (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 reassigned OFBIZ-2208:
--------------------------------------

    Assignee: Jacques Le Roux

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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=12677729#action_12677729 ]

David E. Jones commented on OFBIZ-2208:
---------------------------------------

Karim: could you verify that you are using MySQL?

As for a solution, I'd rather see an error in the log than overwrite existing data... which is what the proposal to use createOrStore instead of just create. So no, let's not change it to use createOrStore... better to get the exception and put it in the 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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=12677732#action_12677732 ]

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

Yes, I agree David, keeping what exists is better.

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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=12677793#action_12677793 ]

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

Also the counter idea is a good one, as Karim proposed I will let the comment in so that people interested will just have to pick the idea.
Waiting for Karim answer to commit. If you need something like that (counter) Karim you could propose a patch though...

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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: Incomplete

The counter idea would have been commited but not this solution has it's incomplete. See  revision 750068.

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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 ]

Karim Rahimpur reopened OFBIZ-2208:
-----------------------------------


Many thanks for your comments.

The thing is that it really does not depend on which DBMS you use, MySql's DateTime being coarser than e.g. Derby's Timestamp
only makes it more probable that a transaction will get aborted due to a 'duplicate' hit when using MySql instead of Derby, but the
problem will still be there: trying to store ServerHits with the same ServerHit.hitStartDateTime and the other fields of the composite
PK also being equal.

I propose a simple solution to this (similar to the counter) and will add a patch accordingly.

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHitBin.java.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] Updated: (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 ]

Karim Rahimpur updated OFBIZ-2208:
----------------------------------

    Attachment: ServerHit.patch

This solution is based on the following considerations:

- there must be a way to distinguish ServerHits independent of the DBMS's granularity for the hitStartDateTime field so that transaction are not aborted by stats operations
- among possible means of distinguishing is to add a counter or to uniquely identify server hits by other means

The attached patch approaches the problem by defining the serverHitId field for the ServerHit entity and using it as its PK. When a server hit is saved, a sequenced id is obtained for the hit, thus avoiding any dependency on hitStartDateTime field granularity.

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.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=12679151#action_12679151 ]

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

Thanks Karim,

This looks like a good solution to me, and I will commit if nobody see a problem with that.

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.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=12679215#action_12679215 ]

David E. Jones commented on OFBIZ-2208:
---------------------------------------

This patches substantially changes an entity without providing an upgrade path (ie using the Old* pattern, creating a new entity, data migration service, etc) and so should not be committed as-is.

Some things that could be done that would not result in a pk change:

1. soften the error so it is handled locally with just and error message and it doesn't affect anything else in the request
2. if the create fails add 1 second to the timestamp (could add 1 millisecond for all databases except MySQL) and try again





> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.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=12679231#action_12679231 ]

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

Ha yes!

I forgot this point, in case Karim prefers this way : [Revisions Requiring Data Migration|http://docs.ofbiz.org/display/OFBTECH/Revisions+Requiring+Data+Migration]

> 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: SVN trunk, Release Branch 4.0
>         Environment: any
>            Reporter: Karim Rahimpur
>            Assignee: Jacques Le Roux
>             Fix For: SVN trunk
>
>         Attachments: ServerHit.patch, ServerHitBin.java.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=12778125#action_12778125 ]

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

Hi Karim,

Any update ?

> 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
>
>
> 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: Incomplete

> 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
>
>
> 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=12778469#action_12778469 ]

Scott Gray commented on OFBIZ-2208:
-----------------------------------

Why close the issue if it represents an unresolved bug?

> 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
>
>
> 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:
------------------------------------


I thought nobody did care about it since this issue is open for 10 months now...
Karim seems no longer interested. I had a look and did not find David's directions very obvious because I did not find a related return and I guess we should change something in GenericValue.store, I gave up...
So as it seems not a problem for nobody, I closed it. But I'm happy to re-open, hopefully I will not have to re-close it in the future...

> 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
>
>
> 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] Updated: (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 ]

Adrian Crum updated OFBIZ-2208:
-------------------------------

    Attachment: ServerHitBin.patch

The attached patch implements David's suggestion.

I don't like that solution either, because in a multi-threaded, multi-cpu environment, duplicates are still possible. It would be better to ignore the supplied long value, and have a synchronized method that gets the current time - that way unique PKs are guaranteed.

By the way, the error is repeatable in the entity reference screen - which fires two requests simultaneously.


> 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
>
>
> 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] Updated: (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 ]

Adrian Crum updated OFBIZ-2208:
-------------------------------

    Attachment: SynchronizedHitBin.patch

SynchronizedHitBin.patch fixes the problem, but it ignores the long value supplied to 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: 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=12778769#action_12778769 ]

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

Hi Adrian,

Couldn't this synchronization slow down things?

> 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.

12