cancel
Showing results for 
Search instead for 
Did you mean: 

Why does Hybris startup hang when near SessionFixationProtectionStrategy? Can I speed it up?

geffchang
Active Contributor
859

Hybris version: 6.3.0.0-SNAPSHOT (can't upgrade to latest at this time)

I've noticed that Hybris startup will hang for a while when it gets to the SessionFixationProtectionStrategy part. After some time, it will proceed and the server starts. Does this part really take a long time, or is it doing other things, but we're just not seeing any logs?

Is this bug specific to an older Hybris version, or is it really just like that? Is there any way I can speed it up?

On another note (and maybe this should be a separate question), I've also noticed that if I add "-Dnet.sf.ehcache.disabled=true" to tomcat.generaloptions in local.properties, it just stays in SessionFixationProtectionStrategy for a really, really long time. ( I was hoping to disable Ehcache ) Anyway, the previous paragraphs doesn't have anything to do with this paragraph.

View Entire Topic
thendricks
Discoverer

I have debugged this issue because we suffer from the exact same problem.

The current workaround is to configure tomcat.startStopThreads to stay below 15 threads.

The reason why limiting threads works is because the Tomcat runs into a concurrency issue when starting the server with too many threads.
The problem appears because of loading multiple *webservices extensions that have a WebConfig class which extends DelegatingWebMvcConfiguration. Looking at thread dumps: 

"Catalina-utility-9" #40 prio=1 os_prio=0 cpu=939.37ms elapsed=109.31s tid=0x00007f4174008c70 nid=0x9ac91 in Object.wait()  [0x00007f42607e1000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.Class.forName0(java.base@17.0.12/Native Method)
        - waiting on the Class initialization monitor for org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration
        at java.lang.Class.forName(java.base@17.0.12/Class.java:467)
        at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:604)
        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
        - locked <0x000000008055b4d8> (a de.hybris.tomcat.HybrisWebappLoader$HybrisWebappClassLoader)
        at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585)

The server seems to be infinitely waiting for DelegatingWebMvcConfiguration which is probably locked because another web extension in another thread has locked the class and some concurrency issue occurred

So the only workaround is to slow down the server startup by reducing threads or enabling the junit tenant, or simply run the tomcat on a machine with less than 15 cores.

I honestly have no idea how to fix this, I couldn't find anyone on the net who suffers from this issue.
This can only be reproduced if the host has enough cores and a big extension stack to force the Tomcat to use more then 15 threads.

My machine has an i7-13850HX with 28 logical processors, meaning tomcat will by default spawn up to 28 threads. We could reproduce this on an i7-12850HX and an i7-11850H. The following localextensions.xml contains enough extensions to force the Tomcat to spawn all 28 threads and multiple extensions with a WebConfig that extends DelegatingWebMvcConfiguration, namely smartedit, smarteditwebservices, cmssmarteditwebservices and cmswebservices.

<?xml version="1.0" encoding="UTF-8"?>
<hybrisconfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="https://schema.sybit.dev/sap-commerce/platform/localextensions.xsd">
    <extensions>
        <path dir="${HYBRIS_BIN_DIR}"/>

        <!-- SAP Model -->
        <extension name="sapmodel"/>
        <extension name="sapmodelbackoffice"/>

        <!-- adaptive search -->
        <extension name="adaptivesearch"/>
        <extension name="adaptivesearchbackoffice"/>
        <extension name="adaptivesearchfacades"/>
        <extension name="adaptivesearchsamplesaddon"/>
        <extension name="adaptivesearchsolr"/>
        <extension name="adaptivesearchwebservices"/>
        <extension name="solrserver"/>

        <extension name="solrfacetsearch"/>
        <extension name="solrfacetsearchbackoffice"/>
        <extension name="searchbackoffice"/>
        <extension name="backofficesolrsearch"/>
        <extension name="searchprovidercssearchservices"/>
        <extension name="searchprovidercssearchbackoffice"/>
        <extension name="searchservices"/>

        <!-- content management -->
        <extension name="smartedit"/>
        <extension name="previewwebservices"/>
        <extension name="smarteditwebservices"/>

        <extension name="permissionswebservices"/>
        <extension name="cmssmarteditwebservices"/>
        <extension name="cmssmartedit"/>
        <extension name="cmswebservices"/>
        <extension name="cmsbackoffice"/>
        <extension name="cmsocc"/>

        <!-- b2b + base commerce -->
        <extension name="commerceservicesbackoffice"/>
        <extension name="b2bcommercebackoffice"/>

        <!-- webservices extensions -->
        <extension name="acceleratorocc"/>
        <extension name="notificationocc"/>
        <extension name="b2bocc"/>
        <extension name="swaggerintegration"/>

        <extension name="assistedservicewebservices"/>
        <extension name="assistedservicestorefront"/>

        <!-- PCM Backoffice extensions -->
        <extension name="pcmbackoffice"/>

        <!--Integration API Extensions-->
        <extension name="odata2services"/>
        <extension name="odata2webservices"/>
        <extension name="sapcpiproductexchange"/>
        <extension name="integrationmonitoringbackoffice"/>
        <extension name="sapcpiorderexchangeb2b"/>
    </extensions>
</hybrisconfig>

 

amine0038
Discoverer
0 Kudos

Hello, honestly i added some memory using java option and it more efficient. It may occurs to have the problem but less frequently

tomcat.generaloptions=${tomcat.jdkmodules.config} -Djava.locale.providers=COMPAT,CLDR -Xmx8G -ea -Dcatalina.base=%CATALINA_BASE% -Dcatalina.home=%CATALINA_HOME% -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=jdk_logging.properties -Djava.io.tmpdir="${HYBRIS_TEMP_DIR}" -Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl -Dorg.springframework.security.core.SpringSecurityCoreVersion.DISABLE_CHECKS=true -Duser.timezone=Europe/Paris

Eddy_
Explorer
0 Kudos
I think that is the solution... thanks!
thendricks
Discoverer
It's rather a workaround than a solution. I reported the problem to the SAP Support and they opened a ticket for their dev team to actually fix this issue. Hopefully this will be resolved in the next version.