Email slow operations

I am evaluating Aspose.Email 19.12 and I notice extremely long execution times. The same hapens with the latest version 22.12

For example …
PersonalStorage personalStorage = PersonalStorage.create(“testing.pst”, FileFormatVersion.Unicode);
… this takes some 92 seconds to finish.

But some cases are even worse, for example this code …
Message.setBody(“TESTING body”);
message.setSubject(“TESTING subject”);
MapiMessage mapiMessage = MapiMessage.fromMailMessage(message);
… never ends executing the last line, and after 20 minutes the Java stack trace looks like this:

sun.security.provider.SHA2.lf_delta1(SHA2.java:198)
sun.security.provider.SHA2.implCompress(SHA2.java:210)
sun.security.provider.DigestBase.engineUpdate(DigestBase.java:139)
java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:580)
java.security.MessageDigest.update(MessageDigest.java:325)
sun.security.util.ManifestEntryVerifier.update(ManifestEntryVerifier.java:174)
java.util.jar.JarVerifier.update(JarVerifier.java:225)
java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:480)
com.aspose.email.internal.ht.zb.a(Unknown Source)
com.aspose.email.internal.ev.za.(Unknown Source)
com.aspose.email.system.io.Stream.fromJava(SourceFile:218)

I am using jBoss AS 7.1 with the following pom.xml:

com.aspose
aspose-email
19.12
jdk16

Please tell me what I am doing wrong … thanks a lot!!!

Hello @abossio,

Let me clarify, only one line

PersonalStorage personalStorage = PersonalStorage.create("testing.pst", FileFormatVersion.Unicode);

takes 92 seconds to execute?
Or are you also add some items to the pst?

Thanks.

Hello Dmitry,

unfortunately the answer is yes, that single line takes 90 seconds to run.

In summary, I have run three tests:

  • test #1 is the creation on an empty PCT file.
  • test #2 is saving a Word document as MHTML (this is an Aspose.Words operation).
  • test #3 is creating a MailMessage from the MHTML data produced by test #2.

The first test is:

// TEST #1
PersonalStorage personalStorage = PersonalStorage.create(“c:\agents\testing.pst”, FileFormatVersion.Unicode);

… and this single line takes 92 seconds, most of the time the Java stracktrace shows:

sun.security.provider.SHA2.lf_sigma0(SHA2.java:171)
sun.security.provider.SHA2.implCompress(SHA2.java:225)
sun.security.provider.DigestBase.engineUpdate(DigestBase.java:139)
java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:580)
java.security.MessageDigest.update(MessageDigest.java:325)
sun.security.util.ManifestEntryVerifier.update(ManifestEntryVerifier.java:174)
java.util.jar.JarVerifier.update(JarVerifier.java:225)
java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:480)
org.jboss.as.server.deployment.module.VFSResourceLoader.getClassSpec(VFSResourceLoader.java:103)
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:234)
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
org.jboss.modules.Module.loadModuleClass(Module.java:517)
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
com.aspose.email.internal.n.za.(Unknown Source)
com.aspose.email.zany.(SourceFile:122)
com.aspose.email.zafo.(SourceFile:85)
com.aspose.email.zatg.(SourceFile:147)
com.aspose.email.PersonalStorage.a(SourceFile:378)
com.aspose.email.PersonalStorage.create(SourceFile:330)

Test #2 is the following line (using Aspose.Words and not Aspose.Email), which takes some 3 minutes to end:

// TEST #2
wordDocument.save(docAsStream, SaveFormat.MHTML);

… and again, during these 3 minutes, the stack trace shows the JarVerifier.update() method running many many times:

sun.security.provider.SHA2.lf_S(SHA2.java:162)
sun.security.provider.SHA2.lf_sigma1(SHA2.java:180)
sun.security.provider.SHA2.implCompress(SHA2.java:224)
sun.security.provider.DigestBase.engineUpdate(DigestBase.java:139)
java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:580)
java.security.MessageDigest.update(MessageDigest.java:325)
sun.security.util.ManifestEntryVerifier.update(ManifestEntryVerifier.java:174)
java.util.jar.JarVerifier.update(JarVerifier.java:225)
java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:480)
org.jboss.as.server.deployment.module.VFSResourceLoader.getClassSpec(VFSResourceLoader.java:103)
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:234)
org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
org.jboss.modules.Module.loadModuleClass(Module.java:517)
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
com.aspose.words.zzZXI.zzZRS(Unknown Source)
com.aspose.words.zzZXI.zzZRZ(Unknown Source)
com.aspose.words.zzZI0.zzZ(Unknown Source)
com.aspose.words.zzZI7.zzZ(Unknown Source)
com.aspose.words.Document.zzZ(Unknown Source)
com.aspose.words.Document.zzZ(Unknown Source)
com.aspose.words.Document.zzZ(Unknown Source)

Test #3 is the following line, which never ends and runs and runs for hours :

// Test #3
MailMessage message = MailMessage.load(new ByteArrayInputStream(docAsStream.toByteArray()), new MhtmlLoadOptions());

… again, the Java stack trace (always) shows the JarVerifier.update() method:

sun.security.provider.SHA2.lf_sigma1(SHA2.java:180)
sun.security.provider.SHA2.implCompress(SHA2.java:224)
sun.security.provider.DigestBase.engineUpdate(DigestBase.java:139)
java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:580)
java.security.MessageDigest.update(MessageDigest.java:325)
sun.security.util.ManifestEntryVerifier.update(ManifestEntryVerifier.java:174)
java.util.jar.JarVerifier.update(JarVerifier.java:225)
java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:480)
com.aspose.email.internal.ht.zb.a(Unknown Source)
com.aspose.email.internal.ev.za.(Unknown Source)
com.aspose.email.system.io.Stream.fromJava(SourceFile:218)
com.aspose.email.internal.ms.core.resources.ResourcesLoader.loadResource(Unknown Source)
com.aspose.email.internal.hp.zd.f(Unknown Source)
com.aspose.email.internal.hp.zd.c(Unknown Source)
com.aspose.email.internal.m.zj.(Unknown Source)
com.aspose.email.internal.m.zb.b(Unknown Source)
com.aspose.email.internal.m.zb.(Unknown Source)
com.aspose.email.internal.m.zb.a(Unknown Source)
com.aspose.email.zlf.a(SourceFile:360)
com.aspose.email.zlf.(SourceFile:28)
com.aspose.email.zhz.a(SourceFile:133)
com.aspose.email.zhz.a(SourceFile:216)
com.aspose.email.zamk.c(SourceFile:218)
com.aspose.email.zamk.a(SourceFile:270)
com.aspose.email.zamk.a(SourceFile:319)
com.aspose.email.zamk.b(SourceFile:173)
com.aspose.email.MailMessage.b(SourceFile:1441)
com.aspose.email.MailMessage.a(SourceFile:1417)
com.aspose.email.MailMessage.a(SourceFile:1486)
com.aspose.email.MailMessage.c(SourceFile:1342)
com.aspose.email.MailMessage.a(SourceFile:1307)
com.aspose.email.MailMessage.load(SourceFile:1300)

As you can see from the stack traces, the three tests was executed inside a JBoss AS 7.1 server, so I thought that environment could be somehow causing problems. Nevertheless, I repeated the tests in a standalone Java application and I got the same results (with even greater execution times). Below you can see part of the stack trace from the standalone Java application, where the infamous JarVerifier.update() appears again:

sun.security.provider.SHA2.lf_S(SHA2.java:162)
sun.security.provider.SHA2.lf_sigma0(SHA2.java:171)
sun.security.provider.SHA2.implCompress(SHA2.java:225)
sun.security.provider.DigestBase.engineUpdate(DigestBase.java:139)
java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:580)
java.security.MessageDigest.update(MessageDigest.java:325)
sun.security.util.ManifestEntryVerifier.update(ManifestEntryVerifier.java:174)
java.util.jar.JarVerifier.update(JarVerifier.java:225)
java.util.jar.JarVerifier$VerifierStream.read(JarVerifier.java:480)
sun.misc.Resource.getBytes(Resource.java:124)
java.net.URLClassLoader.defineClass(URLClassLoader.java:444)
java.net.URLClassLoader.access$100(URLClassLoader.java:71)
java.net.URLClassLoader$1.run(URLClassLoader.java:361)
java.net.URLClassLoader$1.run(URLClassLoader.java:355)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:354)
java.lang.ClassLoader.loadClass(ClassLoader.java:425)

  • locked java.lang.Object@4d4e03a4
    sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    asposewobfuscated.zz84.zzZ(Unknown Source)
    asposewobfuscated.zz6K.zzFO(Unknown Source)
  • locked java.lang.Class@28099a34
    asposewobfuscated.zzBJ.(Unknown Source)

Please could you provide any help? Thanks in advance!!!

Hello @abossio,

It seems the issue is with the environment, because we haven’t encountered such slow performance before. In addition, there are no heavy operations in the PersonalStorage.create method. In any case, we will try to look into your issue and share conclusions as soon as possible.
Thanks.

Hello @abossio,

The issue is probably the java class loader which tries to verify the jar file.
You can try to disable verification by deleting the .RSA and .SF within a jar files.
To ensure a timely and accurate response, please create a standalone simple Java application that helps us reproduce your problem on our end.