How to configure convertcache working directory

Hi all

I'm trying to configure a new convertcache directory for file preview. I've found this guide https://doc.nuxeo.com/60/nxdoc/conversion/ In particular, this point:

Configuring the Conversion Service

The Conversion Service supports a global configuration via XML file in order to configure caching.

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.core.convert.config">
<extension target="org.nuxeo.ecm.core.convert.service.ConversionServiceImpl"
point="configuration">
<configuration>
<!-- define directory location for caching : default to java default tmp dir (java.io.tmpdir) -->
<cachingDirectory>/var/ConversionCache</cachingDirectory>
<!-- GC interval in minutes (default = 10 minutes ) -->
<gcInterval>10</gcInterval>
<!-- maximum size for disk cache in KB (default to 10*1024) -->
<diskCacheSize>1024</diskCacheSize>
<!-- Enables or disables caching (default = true)-->
<enableCache>true</enableCache>
</configuration>
</extension>
</component>

Well, I've put a new convert-config.xml file in nxserver/config and restarted my server. Using platform explorer, I've verified that Nuxeo is parsing the new file without problems, log file does not warn me about any mistake. Here is the code of my new component (no name conflict)

<extension point="configuration" target="org.nuxeo.ecm.core.convert.service.ConversionServiceImpl"> 
    <configuration>
        <gcInterval>1</gcInterval>
        <diskCacheSize>1</diskCacheSize>
        <enableCache>true</enableCache>
        <cachingDirectory>/home/athento/CONVERTCACHE</cachingDirectory>
    </configuration>
</extension>`

But the server seems to ignore this changes.

Looking in Nuxeo source code, I've found this lines (available here https://github.com/nuxeo/nuxeo/blob/6.0-HF27/nuxeo-core/nuxeo-core-convert/src/main/java/org/nuxeo/ecm/core/convert/extension/GlobalConfigDescriptor.java)

public void update(GlobalConfigDescriptor other) {
if (other.GCInterval != DEFAULT_GC_INTERVAL_IN_MIN) {
GCInterval = other.GCInterval;
}
if (other.diskCacheSize != DEFAULT_GC_INTERVAL_IN_MIN) {
diskCacheSize = other.diskCacheSize;
}
if (other.cachingDirectory != defaultCachingDirectory().getAbsolutePath()) {
cachingDirectory = other.cachingDirectory;
}
}

First thing I've noticed is the String comparison for other.cachingDirectory variable. Shouldn't it be using String.equals() method?

Looking a litle bit deeper, I've found that defaultCachingDirectory variable MUST be initialized for this comparison, which, IMHO is completely unnecesary. In fact, I'm trying to change the convertercache directory because of a disk error on that inode, so initting this variable causes a unrecoverable exception and all the ConverterService is completely unavailable from the very beginning.

If you want to compare Strings, why not compare just Strings and avoid File use and, why not use specific methods for that purpose (i mean, equals) ?

If anybody can give me any clues, will be much appreciated.

Regards, Paco

3 votes

2 answers

2839 views

ANSWER



Thank you for reporting this, I've opened NXP-21126 to fix this.

1 votes



Thanks for creating the ticket. Here is our workaround while the ticket is solved just in case somebody needs an urgent solution.

Place it in nuxeo source files at nuxeo-core/nuxeo-core-convert/src/main/java/org/nuxeo/ecm/core/convert/extensions and compile the bundle. Place it in your nuxeo instance replacing original and restart the server. Remember to put the -config.xml file in nxserver/config to configure your new convert cache directory.

Regars.

0 votes