Even after committing the patch for KNOX-1387, it seemed to me that something was still wrong, at least partly because I started seeing similar behavior for another filter. Some filters were being invoked before they had been initialized.
Well, after quite a bit of debugging, I discovered a bug in GatewayFilter. The Holder inner class has a getInstance() method, which creates an instance of the associated filter if it has not yet been initialized. The implementation of this method was assigning the Filter member *prior* to invoking its *init* method. This was fine so long as only one thread invoked *getInstance()* at one time. With multiple concurrent threads, the issue manifest: Thread1: instance == null --> true Thread1: instance = new Filter() Thread2: instance == null --> false Thread2: instance.doFilter() Thread1: instance.init() This is why subsequent invocations succeeded; the initialization eventually happened, and the subsequent invocations found the instance member assigned and initialized. Via KNOX-1390, I've modified this implementation to perform the initialization prior to the assignment of the member variable. This may mean that the instance member gets initialized twice (because the second thread finds instance is null); while less than ideal, I believe this is ok, and certainly better than what was happening. So, this appears to be resolved at this point. - Phil On Fri, Jul 13, 2018 at 8:33 AM Phil Zampino (JIRA) <[email protected]> wrote: > > [ > https://issues.apache.org/jira/browse/KNOX-1387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel > ] > > Phil Zampino resolved KNOX-1387. > -------------------------------- > Resolution: Fixed > > > NPE in new installation > > ----------------------- > > > > Key: KNOX-1387 > > URL: https://issues.apache.org/jira/browse/KNOX-1387 > > Project: Apache Knox > > Issue Type: Improvement > > Components: Server > > Affects Versions: 1.1.0 > > Reporter: Phil Zampino > > Assignee: Phil Zampino > > Priority: Major > > Fix For: 1.1.0 > > > > > > > > > -- > This message was sent by Atlassian JIRA > (v7.6.3#76005) >
