Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 84199 invoked from network); 14 Oct 2008 11:10:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Oct 2008 11:10:06 -0000 Received: (qmail 2843 invoked by uid 500); 14 Oct 2008 11:10:06 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 2803 invoked by uid 500); 14 Oct 2008 11:10:06 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 2792 invoked by uid 99); 14 Oct 2008 11:10:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Oct 2008 04:10:05 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Oct 2008 11:09:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3C0AF234C21B for ; Tue, 14 Oct 2008 04:09:44 -0700 (PDT) Message-ID: <610315623.1223982584231.JavaMail.jira@brutus> Date: Tue, 14 Oct 2008 04:09:44 -0700 (PDT) From: "Karl Pauls (JIRA)" To: dev@felix.apache.org Subject: [jira] Updated: (FELIX-765) Invalid occasional OSGi filter toString() value In-Reply-To: <1951457273.1223971904256.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FELIX-765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Karl Pauls updated FELIX-765: ----------------------------- Attachment: ldap.patch Don, I'm sorry that you have so many issues with our ldap filter. It's great so, that we seem to get some of the bugs figured out. Can you please see whether the attached patch makes a difference? It's just a guess but it might be the answer already. If not then I will have to try to reproduce the error first... > Invalid occasional OSGi filter toString() value > ----------------------------------------------- > > Key: FELIX-765 > URL: https://issues.apache.org/jira/browse/FELIX-765 > Project: Felix > Issue Type: Bug > Components: Framework > Affects Versions: felix-1.2.2 > Reporter: Don Brown > Attachments: ldap.patch > > > Rather frequently, under the right conditions, FilterImpl.toString() will generate an invalid filter string. In my case, this happens when Spring DM loads two bundles on two different threads simultaneously when processing a number of OSGi service imports. The actual stracktrace isn't very useful since what Spring DM does internally is get a filter's string, pass that around a bit, then try to give that to Felix, which causes an exception. I narrowed the problem down to the toString() method: > java.lang.RuntimeException: Invalid filter string:(&some49(&(bean-name=some49)(plugins-host=true))) > at org.apache.felix.framework.FilterImpl.checkFilter(FilterImpl.java:330) > at org.apache.felix.framework.FilterImpl.toString(FilterImpl.java:244) > at java.lang.String.valueOf(String.java:2615) > at java.lang.StringBuffer.append(StringBuffer.java:220) > at org.springframework.osgi.service.importer.DefaultOsgiServiceDependency.(DefaultOsgiServiceDependency.java:53) > at org.springframework.osgi.extender.internal.dependencies.startup.MandatoryImporterDependencyFactory.getServiceDependencies(MandatoryImporterDependencyFactory.java:69) > at org.springframework.osgi.extender.internal.dependencies.startup.DependencyServiceManager.findServiceDependencies(DependencyServiceManager.java:233) > at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:253) > at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:173) > at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:136) > at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:741) > at java.lang.Thread.run(Thread.java:613) > This checkFilter() method simply looks for invalid strings where the '&' character isn't followed by a '(' character: > public static void checkFilter(String filter) > { > if (filter != null) > { > boolean andFound = false; > for (int x=0; x { > char c = filter.charAt(x); > if (c == '&') { > andFound = true; > } else if (andFound && c != '(') { > throw new RuntimeException("Invalid filter string:"+filter); > } else > andFound = false; > } > } > } > Deeper in the code, I put this check in Parser to find out when this invalid filter String was being created (line 594): > for (int x=0; x if (tmp[x] instanceof ConstOperator) { > System.out.println("Invalid tree constructed:"+tmp[x]); > } > } > This detected when the const operator was incorrectly listed as a child of the AND operator, but I also saw the PUSH operator a direct child as well. > Therefore, this issue seems related to FELIX-721, although I was unable to find a direct fix. For now, I'm commenting out the program cache in FilterImpl line 64, which fixes the issue and has a negligible impact on performance from my testing. Since we are seeing this exception between 10% and 80% of the time, a slower Felix is preferable to a frequently broken startup. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.