You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Yasser Zamani (JIRA)" <ji...@apache.org> on 2018/12/02 07:29:00 UTC
[jira] [Resolved] (WW-4986) Race condition reloading config results
in actions not found
[ https://issues.apache.org/jira/browse/WW-4986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yasser Zamani resolved WW-4986.
-------------------------------
Resolution: Duplicate
Assignee: Yasser Zamani
I probed that WW-4974 resolution also resolves this race condition. This race condition currently often occurs because currently Struts always reloads configs even {{struts-default.xml}} config due to a bug. WW-4974 resolution resolves that bug so the probability of race condition decreases to a small value that could be ignored especially because reloading configs is a feature for non-production development environments.
> Race condition reloading config results in actions not found
> ------------------------------------------------------------
>
> Key: WW-4986
> URL: https://issues.apache.org/jira/browse/WW-4986
> Project: Struts 2
> Issue Type: Bug
> Components: XML Configuration
> Affects Versions: 2.5.18
> Reporter: Tamás Faragó
> Assignee: Yasser Zamani
> Priority: Major
> Labels: 404-error, action, race-condition, reloading
> Fix For: 2.6, 2.5.19
>
>
> Issue only occurs when the following xml configuration is present :
> “struts.configuration.xml.reload” is set to true .
>
> The reload flag is supposed to reload the xml configuration when it changes. To this end it calls the synchronized method com.opensymphony.xwork2.config.impl.DefaultConfiguration::reloadContainer. This clears out the packageContext map. The issue is that this operation is not thread safe as none of the other accessors of this map (for example com.opensymphony.xwork2.config.impl.DefaultConfiguration::getPackageConfigs which is the cause of the disappearing actions) is not synchronized .
> A solution would be totally rebuild the context into a separate temporary object and reassign it at the end.
>
>
> To make matters worse is that this reloading happens on almost every single request due to some other race condition which I haven't figured out yet.
> * For some reason DefaultFileManagerFactory (which is not a singleton) fails to properly set DefaultFileManagerFactory::setReloadingConfigs from the XML thus reloadConfigs is false which causes DefaultFileManager::setReloadingConfigs to be false, which means that when struts doesn’t monitor files (DefaultFileManager::monitorFile) and the files cache is empty.
> * Now this would work, but the code that calls DefaultFileManager::fileNeedsReloading and DefaultFileManager::loadFile is a different instance of this class, where the first one has reloadingConfigs set to true, and in the second one to false.
> * Somewhere in XWorkConverter::SetFileManagerFactory > DefaultFileManagerFactory::getFileManager > DefaultFileManager::setReloadingConfigs using the same stack (at least to this level) the configuration is not read properly.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)