Description of problem: Catalina.out returns the error "ERROR com.redhat.rhn.common.hibernate.HibernateFactory - Query exectued with Collection larger than 1000" when searching packages" Version-Release number of selected component (if applicable): Spacewalk 1.6 How reproducible: 100% Steps to Reproduce: 1. Using the webUI or API, search for a package kernel (or some package which number is higher than 100) Actual results: "ERROR com.redhat.rhn.common.hibernate.HibernateFactory - Query exectued with Collection larger than 1000" when searching packages" is showed at catalina.out Expected results: ERROR be shown when searching larger than 100 packages Additional info: Looking the function bindParameters(), we can observe that there is typo. The if condition takes 100 instead 1000. java/code/src/com/redhat/rhn/common/hibernate/HibernateFactory.java ---------------------------------------------------------------------------- 124 private Query bindParameters(Query query, Map parameters) 125 throws HibernateException { 126 if (parameters == null) { 127 return query; 128 } 129 130 Set entrySet = parameters.entrySet(); 131 for (Iterator itr = entrySet.iterator(); itr.hasNext();) { 132 Map.Entry entry = (Map.Entry) itr.next(); 133 if (entry.getValue() instanceof Collection) { 134 Collection c = (Collection) entry.getValue(); 135 if (c.size() > 100) { 136 LOG.error("Query exectued with Collection larger than 1000"); 137 } 138 query.setParameterList((String) entry.getKey(), c); 139 } 140 else { 141 query.setParameter((String) entry.getKey(), entry.getValue()); 142 } 143 } 144 145 return query; 146 }
Created attachment 515135 [details] Patch proposed Hello, Here follow a patch which fixes the test condition (when larger than 1000) and the LOG.error statement. Patch were sent to Spacewalk Devel to approval. Mail Thread: https://www.redhat.com/archives/spacewalk-devel/2011-July/msg00041.html Cheers, Marcelo Moreira de Mello
Hello, Reproducer output: We were able to reproduce the issue internally in our labs. Connecting through API, using a Python script we were able to reproduce the issue as you can look below: # ./satellite-tool --search kernel ############################################################ Searching Packages kernel-2.6.32-131.6.1.el6.x86_64 The Linux kernel kernel-2.6.18-238.19.1.el5.x86_64 The Linux kernel (the core of the Linux operating system) [ .... SNIP .... ] kernel-2.6.18-8.el5.x86_64 The Linux kernel (the core of the Linux operating system) Summary: ---------------------------- Total of Packages Found: 167 At catalina.out we have: /var/log/tomcat6/catalina.out ------------------------------------------------- 2011-07-25 16:59:24,773 [TP-Processor7] WARN com.redhat.rhn.frontend.action.channel.PackageSearchHelper - Performing pkg search: kernel, search_name_and_description 2011-07-25 16:59:25,510 [TP-Processor7] ERROR com.redhat.rhn.common.hibernate.HibernateFactory - Query exectued with Collection larger than 1000
Fix committed to Spacewalk master, 9886c8d2bdd11d13d67f69ddff2231612edfaf25. Thank you! Jan
Spacewalk 1.6 has been released.