I have a skin system that runs multiple skins in the same application. A skin is selected in onRequestStart() based on the http host name for the request. Each skin implements tags like <cf_head> and <cf_body> and <cf_footer> and so forth, and these tags exist in the skin’s root directory. All skins share a few other customTagPaths.
This mostly works, but Lucee is having some issues resolving the location of a tag named <cf_footer> (footer.cfm) in one of my skins. Lucee is choosing a footer.cfm file found in a shared tags directory rather than a footer.cfm located in the same directory from where it is being referenced. In other words, body.cfm and footer.cfm are both in the same directory. body.cfm calls <cf_footer> and Lucee thinks it’s the one in a shared customTagPaths.
Thanks,
-JP
OS: Linux
Java Version: 21.0.10. (Temurin)
Tomcat Version: 11.0.21
Lucee Version: 6.2.6.19
Hi @Redtopia, thanks for reporting this. It looks like a bug in Lucee’s custom tag path cache, not in your code. I could reproduce it on 6.2 and 7.1 builds.
Lucee does see the updated customTagPaths. But before it searches the folders, it checks the cache for all the paths. If a tag was already cached from a later path that your skins share, that one is returned, even if the current skin has its own version in an earlier path. The position of a path in the list is part of the cache key, which is why changing the order helps.
Until it’s fixed, you can try one of these:
- Turn off “Cache” in the Lucee admin under Archives & Resources > Custom Tags. Lucee then searches the folders on every custom tag call.
- Call ctCacheClear() after you set the paths. This worked in my test, but it clears the cache for all requests, so it can still go wrong when different skins are requested at the same time.
Could you share an example of customTagPaths for two of your skins? I’d like to confirm that they share a folder, so we know it’s the same problem.
Ticket: Jira
Thanks @cfmitrah. I edited my question slightly, but I understand what you’re suggesting and I’ll try it. Yes, it seems like Lucee is finding whatever cached version of footer.cfm if found first.
I’m also worried about performance. I would like the tags to be cached and not inspected/loaded on each request.
Thanks for the details. I can reproduce your exact case on 6.2 and 7.1 builds, so this is a bug in Lucee: a cached tag from a shared path is used even when footer.cfm exists in the same directory as body.cfm.
You can keep the cache on and call the affected tag by file instead:
<cfmodule template="footer.cfm">
Alternatively, you can turn off “Cache” under Archives & Resources > Custom Tags. Lucee then looks up the tag’s location on each call, but it doesn’t recompile the tag.
You can follow the progress here: Jira