Bug 725555 - catalina.out returns the error "ERROR com.redhat.rhn.common.hibernate.HibernateFactory - Query exectued with Collection larger than 1000" when searching packages
Summary: catalina.out returns the error "ERROR com.redhat.rhn.common.hibernate.Hiberna...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 1.6
Hardware: All
OS: All
medium
medium
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space16 725562
TreeView+ depends on / blocked
 
Reported: 2011-07-25 20:27 UTC by Marcelo Moreira de Mello
Modified: 2011-12-22 16:47 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 725562 (view as bug list)
Environment:
Last Closed: 2011-12-22 16:47:57 UTC
Embargoed:


Attachments (Terms of Use)
Patch proposed (1.19 KB, patch)
2011-07-25 20:36 UTC, Marcelo Moreira de Mello
no flags Details | Diff

Description Marcelo Moreira de Mello 2011-07-25 20:27:14 UTC
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     }

Comment 1 Marcelo Moreira de Mello 2011-07-25 20:36:12 UTC
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

Comment 2 Marcelo Moreira de Mello 2011-07-25 20:48:22 UTC
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

Comment 3 Jan Pazdziora 2011-07-26 06:14:45 UTC
Fix committed to Spacewalk master, 9886c8d2bdd11d13d67f69ddff2231612edfaf25.

Thank you!

Jan

Comment 4 Milan Zázrivec 2011-12-22 16:47:57 UTC
Spacewalk 1.6 has been released.


Note You need to log in before you can comment on or make changes to this bug.