Openbravo Issue Tracking System - Retail Modules |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0036288 | Retail Modules | Web POS | public | 2017-06-19 19:18 | 2018-01-22 15:21 |
|
Reporter | shuehner | |
Assigned To | gorka_gil | |
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | RR17Q4 | |
Merge Request Status | |
Review Assigned To | marvintm |
OBNetwork customer | OBPS |
Support ticket | 47629 |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0036288: (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* ERROR |
Description | LogClientLoader expects to see duplicate messages and logs + then ignores the duplicate row.
However apart from that INFO message 2* ERROR are logged to openbravo.log including the full json message which in some customers is a huge amount of the ERROR's messages seen per day.
Those 2*ERROR should be supressed.
Example case:
70a8a81e 2017-06-19 11:50:33,164 [ajp-bio-127.0.0.1-8009-exec-171] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 inser
t into obmobc_logclient (AD_Client_ID, AD_Org_ID, Isactive, Created, Createdby, Updated, Updatedby, Deviceid, Msg, Loglevel, Cache_Sess
ion_ID, Isonline, Obmobc_Logclient_ID) values ('AA', 'BB', 'Y', '2017-6-19
11:48:57.908000 -5:0:0', 'CC', '2017-6-19 11:50:33.161000 -5:0:0', 'CC', 'DEVICEID', 'runSyncProcess: synchronization successfully done; stackTrace: https://the.url/openbravo/web/js/gen/bd5 [^]
2e366338bc6dc386ed72358a97e05_WebPOS.js:1487:483', 'Info', 'DF929F87F1334E61BCDF9ABC23837689', 'Y', '9E51244B6472BA64D4C59580D19D1A00')
was aborted. Call getNextException to see the cause.
70a8a81e 2017-06-19 11:50:33,164 [ajp-bio-127.0.0.1-8009-exec-171] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "obmobc_logclient_pk"
Detail: Key (obmobc_logclient_id)=(9E51244B6472BA64D4C59580D19D1A00) already exists.
70a8a81e 2017-06-19 11:50:33,174 [ajp-bio-127.0.0.1-8009-exec-171] INFO org.openbravo.mobile.core.utils.LogClientLoader - Found duplicated log client message with id: 9E51244B6472BA64D4C59580D19D1A00. Ignoring
|
Steps To Reproduce | . |
Proposed Solution | |
Additional Information | |
Tags | No tags attached. |
Relationships | depends on | backport | 0037697 | RR17Q3.3 | closed | marvintm | (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* ERROR |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2017-06-19 19:18 | shuehner | New Issue | |
2017-06-19 19:18 | shuehner | Assigned To | => Retail |
2017-06-19 19:18 | shuehner | OBNetwork customer | => No |
2017-06-19 19:18 | shuehner | Triggers an Emergency Pack | => No |
2017-07-13 12:43 | maite | OBNetwork customer | No => Yes |
2017-07-13 12:43 | maite | Support ticket | => 47629 |
2017-07-13 12:43 | maite | Resolution time | => 1501711200 |
2017-07-13 12:44 | maite | Issue Monitored: networkb | |
2017-08-04 14:16 | marvintm | Resolution time | 1501711200 => 1502748000 |
2017-08-21 08:23 | marvintm | Resolution time | 1502748000 => 1504130400 |
2017-09-07 16:35 | gorka_gil | Assigned To | Retail => gorka_gil |
2017-09-07 16:47 | gorka_gil | Note Added: 0098889 | |
2017-09-07 16:47 | gorka_gil | Note Deleted: 0098889 | |
2017-09-12 16:29 | gorka_gil | Note Added: 0098991 | |
2017-09-12 16:47 | gorka_gil | Note Added: 0098992 | |
2017-09-18 10:57 | gorka_gil | Note Edited: 0098991 | bug_revision_view_page.php?bugnote_id=0098991#r15917 |
2017-09-18 10:59 | gorka_gil | Note Added: 0099095 | |
2017-09-18 11:02 | hgbot | Checkin | |
2017-09-18 11:02 | hgbot | Note Added: 0099096 | |
2017-09-18 11:02 | hgbot | Status | new => resolved |
2017-09-18 11:02 | hgbot | Resolution | open => fixed |
2017-09-18 11:02 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/77be95078aa45a3a1d621db07654da0f6337e6d5 [^] |
2017-09-18 11:10 | marvintm | Review Assigned To | => marvintm |
2017-09-18 11:10 | marvintm | Note Added: 0099097 | |
2017-09-18 11:10 | marvintm | Status | resolved => closed |
2017-09-18 11:10 | marvintm | Fixed in Version | => RR17Q4 |
2017-09-22 14:40 | hgbot | Checkin | |
2017-09-22 14:40 | hgbot | Note Added: 0099495 | |
2017-09-26 14:05 | gorka_gil | Note Added: 0099580 | |
2017-09-27 15:31 | hgbot | Checkin | |
2017-09-27 15:31 | hgbot | Note Added: 0099633 | |
2018-01-22 15:21 | marvintm | Status | closed => new |
2018-01-22 15:21 | marvintm | Resolution | fixed => open |
2018-01-22 15:21 | marvintm | Fixed in Version | RR17Q4 => |
2018-01-22 15:21 | marvintm | Status | new => scheduled |
2018-01-22 15:21 | marvintm | Status | scheduled => resolved |
2018-01-22 15:21 | marvintm | Fixed in Version | => RR17Q4 |
2018-01-22 15:21 | marvintm | Resolution | open => fixed |
2018-01-22 15:21 | marvintm | Status | resolved => closed |
Notes |
|
(0098991)
|
gorka_gil
|
2017-09-12 16:29
(edited on: 2017-09-18 10:57) |
|
If needed to reproduce the problem manually it will help these tips:
1) To force the sync of the log from chrome console to the backend:
OB.UTIL.processLogClientAll();
2) To generate client log lines:
OB.info('logline_info');
OB.warn('logline_warn');
OB.error('logline_error');
3) Also disabling the delete of already synchronized log, helps to have duplicated lines:
--- a/web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js Fri Sep 08 14:50:58 2017 +0200
+++ b/web/org.openbravo.mobile.core/source/utils/logClientSyncUtils.js Tue Sep 12 16:25:58 2017 +0200
@@ -15,12 +15,12 @@
OB.UTIL.processLogClientAll = function () {
// if the application is busy, delay flushing the log to the server
- if (!OB.MobileApp.model.loadingErrorsActions.executed) {
- if (OB.MobileApp.model.get('isLoggingIn') || !OB.UTIL.SynchronizationHelper.isSynchronized()) {
- OB.debug("LogClient flushing delayed");
- return false;
- }
- }
+// if (!OB.MobileApp.model.loadingErrorsActions.executed) {
+// if (OB.MobileApp.model.get('isLoggingIn') || !OB.UTIL.SynchronizationHelper.isSynchronized()) {
+// OB.debug("LogClient flushing delayed");
+// return false;
+// }
+// }
// Processes log client
if (OB.MobileApp.model.get('connectedToERP')) {
@@ -61,9 +61,9 @@
return;
}
console.warn("Log client failed to log:\n" + toJson.msg);
- OB.Dal.remove(logClient, null, function (tx, err) {
- OB.UTIL.showError(err);
- });
+// OB.Dal.remove(logClient, null, function (tx, err) {
+// OB.UTIL.showError(err);
+// });
}
});
@@ -83,9 +83,9 @@
}
} else {
logClients.each(function (logClient) {
- OB.Dal.remove(logClient, null, function (tx, err) {
- OB.UTIL.showError(err);
- });
+// OB.Dal.remove(logClient, null, function (tx, err) {
+// OB.UTIL.showError(err);
+// });
});
if (successCallback) {
successCallback();
|
|
|
|
Discussed and decided for this issue that not needed to add tests. |
|
|
|
Finally, after rethink, decided to add tests.
Not to test the issue itself, since is quite complex to reproduce consistently, but just to add a log and check that is added in the backend database, with the correct fields filled. |
|
|
(0099096)
|
hgbot
|
2017-09-18 11:02
|
|
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 77be95078aa45a3a1d621db07654da0f6337e6d5
Author: Gorka Gil <gorka.gil <at> openbravo.com>
Date: Thu Sep 14 13:00:06 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/77be95078aa45a3a1d621db07654da0f6337e6d5 [^]
Fixed issue 36288: (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* error
Controled the exception when inserting the log line in the backend, for the case of duplicate id.
To control the exception needed to not use DAL nor xsql, and use instead a prepared statement directly.
In the case of error, we do a sql in the db and if the id is in the db, is a duplicated and everthing is fine.
Note that this case of duplicate is not common case, so this query to check duplicates should not be very frequent.
A future improvement is the use of merge functionality of postgres 9.5 that has upsert, that can do inserts and
ignore the cases of duplicates. But also needed to find something similar in oracle.
Note that in the moment of fix we still support postgres 9.3 so not possible to use it.
Other option was the use of interceptors but will affect all the queries of the application so was discarded.
---
M src/org/openbravo/mobile/core/utils/LogClientLoader.java
---
|
|
|
|
Test will be added later. |
|
|
(0099495)
|
hgbot
|
2017-09-22 14:40
|
|
|
|
|
Repository: tools/automation/pi-mobile
Changeset: 51f5c83109d9
Author: Gorka Gil <gorka.gil <at> openbravo.com>
Date: Fri Sep 22 14:23:23 2017 +0200
URL: https://code.openbravo.com/tools/automation/pi-mobile/rev/51f5c83109d9 [^]
Related to issue 36288: (Expected) duplicate pk on insert of Logclient apart from info message still logs 2* error
Force added info and warn log
force the sync to the backend
check that are inserted into the db correctly
Note: not tested error log, since if info and warn works error should also work, and also not needed to add to the allowed errors with the risk of hide other errors.
---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/system/I36288_CheckLogClientLoad.java
--- |
|
|
(0099633)
|
hgbot
|
2017-09-27 15:31
|
|
|