Free Support Forum - aspose.com

Aspose license checks slow to perform

The startup times of our server software are often badly affected by Aspose’s slow license checks. The issue occurs due to the fact that Aspose’s license check seems to require sufficient entropy available on the machine. Since many of our deployments are headless servers, sufficient entropy is hard to come by. In future updates, could Aspose please remove the SecureRandom dependency from their license check?

Hi Jamie,


Thank you for contacting Aspose support team.

I have checked the documents but no such issue is reported earlier, We have not faced any delay in the initialization of the license yet. This issue needs to be reproduced for further investigation by the product team. Could you please guide us, by specifying the steps, to reproduce the issue here? It will help us to analyze the problem and provide assistance accordingly.

Sure. Write a program to perform license checks using all components under Aspose Total. Thereafter, create a new clean instance of Debian headless server on Amazon/Google Compute/Azure. Without doing too much, run:


cat /proc/sys/kernel/random/entropy_avail

If the value is below 10, you know there is not alot of entropy on the machine. Upload and run the test program and observe the length of time it takes to perform the license check.

The reason why it is slow is mostly like due to use of SecureRandom.

Now, install rngtools according to https://www.howtoforge.com/helping-the-random-number-generator-to-gain-enough-entropy-with-rng-tools-debian-lenny. Afterwards, cat /proc/sys/kernel/random/entropy_avail. You should see a higher value. Now, re-run the program and observe that this time the test program runs much faster.

The point is on some machine the Aspose license checks are slowing the startup of our server in some cases to an unacceptable 15 minutes.

Do not install the desktop version of Linux, only headless. See http://stackoverflow.com/questions/19981189/how-does-the-kernel-entropy-pool-work for description of how this works.


If at all possible, Aspose needs to eliminate the use of SecureRandom in their license checks.

Hi,


Thank you for sharing further information. We are working over this and will soon share our feedback with you here.

Hi,

Could you please share the specs of your VM with us? e.g. m1, m2 or m4 and instance type (small, medium or large). Please share the CPU and memory specifications with us for our consideration. We’re having some problems establishing environment on the Cloud server and will try to establish a local VM of these specs for investigating the issue further our end.

The size of the VM shouldn’t matter. We installed Headless Ubuntu server 16.04 on Google Compute.

When the OS doesn’t have enough entropy, Aspose takes ages to start. You simply have to create the conditions whereby there is not enough entropy on a machine, such as a clean install of Linux headless.

Hi Jamie,


Thank you for providing additional information.

Can you please elaborate why installing the desktop version of the server is not going to work for reproducing the issue? We downloaded and installed the mentioned server version from Ubuntu releases as a VM, but were not able to get the entropy value < 10 in our case. In our case, the Entropy is always around 350-500.

Also, are you using the Java versions of the API for this? Could you please disable the license checking in your application and check if that makes a difference just to be sure that the license check is the definite reason behind this issue.

Hi Jamie,


We managed to create an instance of Ubuntu server 16.04 on Google Compute. It is a fresh VM but it is having Entropy much higher than you mentioned i.e. > 216 always as can be seen in this screenshot. It seems difficult to us for getting a test environment where the entropy level is < 10.

Also, we need a little guidance in deploying a test application on this server remotely. Could you please mention the steps that we could follow to deploy a test application on this server? If possible, please share your sample application/code with us for our further assistance in this regard.

This is because the entropy is not used up yet. Please adjust your license checks not to use SecureRandom and other algorithms that might require entropy on the machine.

Due Aspose license check problems, I have to implement the below and in fact our server starts up before Aspose is even initialized because Aspose typically takes 2-3 minutes and sometimes 10 minutes to startup on a machine low on entropy.

private static void initAsposeLicense() {
ExecutorService execute = Executors.newCachedThreadPool(ThreadUtil.getFlexibleThreadFactory(“aspose”, false));
execute.execute(new InitAsposeLicense(new com.aspose.cells.License(), ASPOSE_LICENSE_FILENAME));
execute.execute(new InitAsposeLicense(new com.aspose.words.License(), ASPOSE_LICENSE_FILENAME));
execute.execute(new InitAsposeLicense(new com.aspose.email.License(), ASPOSE_EMAIL_LICENSE_FILENAME));
execute.execute(new InitAsposeLicense(new com.aspose.slides.License(), ASPOSE_LICENSE_FILENAME));
//takes a very long time to license & we are not using it.
//executor.execute(new InitAsposeLicense(new com.aspose.pdf.License(), ASPOSE_LICENSE_FILENAME));
}

static class InitAsposeLicense extends Thread {
private final String filename;
private final Object license;

    InitAsposeLicense(Object license, String filename) {
        this.license = license;
        this.filename = filename;
        setName("initaspose {filename='" + filename + "'");
    }

    @Override
    public void run() {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try (InputStream is = cl.getResourceAsStream(filename)) {
            license.getClass().getDeclaredMethod("setLicense", java.io.InputStream.class).invoke(license, is);
        } catch (Exception e) {
            logger.error("failed to license aspose:" + e.getMessage() + " {filename='" + filename + "'}", e);
        }
    }
}

@jamie-1,

Thank you for getting back to us and sharing your feedback. If we consider this requirement to be fulfilled on your end or do we need to help you further in this regard.

This issue has been brought up on a number of occasions by different Aspose customers, and rather than deal with the issue Aspose chooses to ignore it. It apparently isn’t problematic that the Aspose library would delay the startup of an entire enterprise software product by ten minutes or more due to a licensing check. Its a classic case of working in a bubble and not listening to the real world needs of your customers.

@jamie-1,

We are sorry for your inconvenience. We are verifying this on our end and an issue with ID EMAILNET-39654 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be addressed.