Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033767
TypeCategorySeverityReproducibilityDate SubmittedLast Update
feature request[Openbravo ERP] A. Platformminorhave not tried2016-08-23 14:432016-12-19 12:17
ReportershuehnerView Statuspublic 
Assigned Toplatform 
PrioritynormalResolutionfixedFixed in Version3.0PR17Q1
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033767: Add code to auto-detect 'accidental double query' on same OBQuery or OBCriteria object

DescriptionThere is a quite common bad coding pattern which calls '.list()' more than one time on the same OBCriteria or OBQuery object.

That will call the underlying sql query also 2 times.

Similar some code without good reason calls .count() + then .list() on the same instance. Which leads to a 'select count(*)' + then another 'select *' sql query.

Detecting such pattern is easy with some extra debugging code inside those 2 utility classes.

See attached patch for a rough patch doing some simple tracking.

Not polished yet but did already find 6 issues in fast manual testing + more 'to be triaged' when running erp-try with it applied.

The attached patch logs a WARN + a stacktrace of the location of and 2nd or 3rd call to either list,count,scroll.uniqueResult.

In practice that 2nd location is enough as a pointer and finding the first call in code is very easy in all examples observed so far.
Steps To Reproducehttps://issues.openbravo.com/view.php?id=33703 [^]
https://issues.openbravo.com/view.php?id=33704 [^]
https://issues.openbravo.com/view.php?id=33705 [^]
https://issues.openbravo.com/view.php?id=33706 [^]
https://issues.openbravo.com/view.php?id=33707 [^]
https://issues.openbravo.com/view.php?id=33709 [^]
TagsPerformance
Attached Filesdiff file icon 33767_prototype.diff [^] (4,677 bytes) 2016-08-23 14:44 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0033703 closedshuehner Openbravo ERP Accidental double query in View generation 
related to defect 0033704 closedshuehner Openbravo ERP Accidental double query in 'selector dropdown' of new style selectors 
related to defect 0033705 closedshuehner Openbravo ERP Double query in PricelistVersionFilterExpression (product selector) 
related to defect 0033706 closedshuehner Openbravo ERP SelectorDataSourceFilter does accidental extra queries in 'Add Payment' flow of Sales Orders 
related to defect 0033707 closedshuehner Openbravo ERP Accidental triple query in OBMessageUtils.getI18NMessage 
related to defect 0033709 closedshuehner Retail Modules Double query for posterminal in POSUtil.getLastDocumentNumber*ForPos 
related to defect 0033769 closedshuehner Openbravo ERP ModuleManagement Settings page load trigger accidental double query to ad_ref_list 
related to defect 0033770 acknowledgedTriage Platform Base Openbravo ERP ModuleManagement install from local obx triggers accidental 4* load of ad_module_dependency 
related to defect 0033771 closedshuehner Openbravo ERP Accidental double query in SE_Invoice_BPartner.isAutomaticCombination 
related to defect 0033773 closedshuehner Openbravo ERP Accidental double queries in Initial Client Setup 
related to defect 0033774 closedshuehner Openbravo ERP Accidental double queries in Initial Org Setup 
related to defect 0033816 closedcaristu Openbravo ERP Find a complete solution to protect OBCriteria.initialize() against multiple calls per instance 
related to defect 0033772 closedshuehner Openbravo ERP Accidental double query in SelectorDefaultFilterActionHandler 
related to defect 0033789 closedshuehner Openbravo ERP Accidental double queries in org.openbravo.services.db.CallProcess 
related to defect 0033790 closedshuehner Openbravo ERP Accidental double query in PriceListVersionFilterExpressionName (order lines, product selector dropdown) 
related to defect 0033794 closedshuehner Openbravo ERP Accidental double queries in DataSourceServiceProvider.getDataSourceFromDataSourceName 
related to defect 0033158 closedshuehner Retail Modules Duplicate query done by accident in OrderLoader.createShipmentLines 
related to feature request 0034770 acknowledgedTriage Platform Base Openbravo ERP Add code to auto-detect 'accidental double query' on same OBQuery object 
related to design defect 0036898 newTriage Finance Openbravo ERP Performance issues when using DAL 

-  Notes
(0092758)
caristu (developer)
2016-12-19 10:49
edited on: 2016-12-19 10:52

Accidental double query in OBCriteria is now detected with the fix for issue 0033816. It will be detected because the initialized method of the OBCriteria instance will be invoked twice, and in that case a warning is displayed in the log.

(0092772)
caristu (developer)
2016-12-19 12:17

Fixed for OBCriteria with the fix for issue 0033816.

A new issue for OBQuery class has been created: 0034770.

- Issue History
Date Modified Username Field Change
2016-08-23 14:43 shuehner New Issue
2016-08-23 14:43 shuehner Assigned To => platform
2016-08-23 14:43 shuehner Modules => Core
2016-08-23 14:43 shuehner Triggers an Emergency Pack => No
2016-08-23 14:43 shuehner Tag Attached: Performance
2016-08-23 14:44 shuehner File Added: 33767_prototype.diff
2016-08-23 14:44 shuehner Relationship added related to 0033703
2016-08-23 14:44 shuehner Relationship added related to 0033704
2016-08-23 14:44 shuehner Relationship added related to 0033705
2016-08-23 14:44 shuehner Relationship added related to 0033706
2016-08-23 14:44 shuehner Relationship added related to 0033707
2016-08-23 14:45 shuehner Relationship added related to 0033709
2016-08-23 16:37 shuehner Relationship added related to 0033769
2016-08-23 17:03 shuehner Relationship added related to 0033770
2016-08-23 17:14 shuehner Relationship added related to 0033771
2016-08-23 17:20 shuehner Relationship added related to 0033772
2016-08-23 17:33 shuehner Relationship added related to 0033773
2016-08-23 17:57 shuehner Relationship added related to 0033774
2016-08-24 11:04 shuehner Relationship added related to 0033789
2016-08-24 11:41 shuehner Relationship added related to 0033790
2016-08-24 14:21 shuehner Relationship added related to 0033794
2016-08-24 15:01 shuehner Relationship added related to 0033158
2016-12-19 10:21 caristu Relationship added related to 0033816
2016-12-19 10:49 caristu Note Added: 0092758
2016-12-19 10:51 caristu Note Edited: 0092758 View Revisions
2016-12-19 10:52 caristu Note Edited: 0092758 View Revisions
2016-12-19 12:10 caristu Issue cloned 0034770
2016-12-19 12:10 caristu Relationship added related to 0034770
2016-12-19 12:17 caristu Review Assigned To => caristu
2016-12-19 12:17 caristu Note Added: 0092772
2016-12-19 12:17 caristu Status new => closed
2016-12-19 12:17 caristu Resolution open => fixed
2016-12-19 12:17 caristu Fixed in Version => 3.0PR17Q1
2017-09-19 18:48 markmm82 Relationship added related to 0036898


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker