[jira] [Created] (ZEPPELIN-2659) shiro.ini parsed twice, causing double and conflicting instatiation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (ZEPPELIN-2659) shiro.ini parsed twice, causing double and conflicting instatiation

JIRA jira@apache.org
Jonathan Tinkham created ZEPPELIN-2659:
------------------------------------------

             Summary: shiro.ini parsed twice, causing double and conflicting instatiation
                 Key: ZEPPELIN-2659
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-2659
             Project: Zeppelin
          Issue Type: Bug
          Components: Core
    Affects Versions: 0.7.2
            Reporter: Jonathan Tinkham
            Priority: Minor


Zeppelin will parse {{shiro.ini}} twice upon startup: once by {{initSecurityManager}} when instantiating a {{SecurityManager}} from the {{IniSecurityManagerFactory}} and a second time by the {{EnvironmentLoaderListener}} attached to the context.

The result is any object created via {{shiro.ini}} will be instantiated twice, potentially causing conflicts. This is most notable when trying to setup EHCache as a cache manager. EHCache uses a named cache for storage and the first parsing of {{shiro.ini}} will create a named cache, causing the second instantiation to fail due to the conflicting name already existing.

The can also be seen by setting the log level to DEBUG in log4j.properties, and observing the double parsing (full logs attached).

{{DEBUG [2017-06-15 20:04:50,659] ({main} ResourceUtils.java[loadFromFile]:147) - Opening file [/opt/zeppelin/conf/shiro.ini]...
DEBUG [2017-06-15 20:04:50,665] ({main} Ini.java[load]:342) - Parsing [users]
DEBUG [2017-06-15 20:04:50,667] ({main} Ini.java[load]:342) - Parsing [main]
DEBUG [2017-06-15 20:04:50,671] ({main} Ini.java[load]:342) - Parsing [roles]
DEBUG [2017-06-15 20:04:50,672] ({main} Ini.java[load]:342) - Parsing [urls]
DEBUG [2017-06-15 20:04:50,674] ({main} IniFactorySupport.java[createInstance]:122) - Creating instance from Ini [sections=users,main,roles,urls]
...
DEBUG [2017-06-15 20:04:55,719] ({main} ResourceUtils.java[loadFromFile]:147) - Opening file [/opt/zeppelin/conf/shiro.ini]...
DEBUG [2017-06-15 20:04:55,720] ({main} Ini.java[load]:342) - Parsing [users]
DEBUG [2017-06-15 20:04:55,721] ({main} Ini.java[load]:342) - Parsing [main]
DEBUG [2017-06-15 20:04:55,725] ({main} Ini.java[load]:342) - Parsing [roles]
DEBUG [2017-06-15 20:04:55,725] ({main} Ini.java[load]:342) - Parsing [urls]
DEBUG [2017-06-15 20:04:55,728] ({main} IniFactorySupport.java[createInstance]:122) - Creating instance from Ini [sections=users,main,roles,urls]}}

The {{WebEnvironment}} created in the {{EnvironmentLoaderListener}} creates a {{SecurityManager}} instance that is usable, making {{initSecurityManager}} redundant, but does require adding an initParameter to the filter, {{staticSecurityManagerEnabled}}, which will perform the {{SecurityUtils.setSecurityManager}} and populate the static memory singleton needed.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)