Using HashMap thread unsafe causes CPU 100%

Source: Internet
Author: User
Tags stack trace

Recently the application server always reported CPU 100%, which is more than 100% CPU. Finally find out is aspectjweaver this jar package uses HashMap is thread insecure. This accident summary is a third-party jar package should always be concerned.

<2015-4-25 08:12 P.M. 44 sec cst> <Error> <WebLogicServer> <BEA-000337> <[stuck] Executethread: ' ' For queue: ' Weblogic.kernel.Default (self-tuning) ' have been busy for "657" seconds working on the request "[Email prot ected][

Post/web/gg/workflow/fore/dospecialforesubmit.jsp?isprogress=false http/1.1
x-forwarded-for:10.124.19.6
Accept:image/jpeg, Application/x-ms-application, Image/gif, Application/xaml+xml, Image/pjpeg, application/ X-MS-XBAP, Application/x-shockwave-flash, Application/vnd.ms-excel, Application/vnd.ms-powerpoint, application/ MSWord, */*
Referer:http://10.150.140.20/web/gg/material/workflow/fore/selforepersons.jsp?pcount=1&pflowkey=gmm_ datalabel_forcsg&pallflag=false&preturnurl=/web/gg/groupmaterial/audit/purchaseplan/ Csgpurchaseplanaudit.jsp?pageno=1|status=auditing|nodestring=null:null; gmm_datalabel_forcsg;000004|framename=p_req_plan_window|labeltype=20&padapterclass= Csgdatalabelforwardadapter&pworkflowid=undefined&pareacode=undefined&pdisplayopinionarea=false &pRequireOpinion=false&pShowRoleFilter=false&pFlag=undefined&pModulePath=gg/material& Psubmitcallback=loading () &pisasync=false&pisprogress=undefined&preadallpage=undefined
Accept-language:zh-cn
user-agent:mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; trident/4.0; mozilla/4.0 (Compatible mozilla/4.0 (compatible-embeddedwb 14.58 http://bsalsa.com/EmbeddedWB-14.58 from:http:// bsalsa.com/; mozilla/4.0 (Compatible RogueCleanerEmbeddedWB-14.58 from:http://bsalsa.com/; SLCC2;. NET CLR 2.0.50727;. NET CLR 3.5.30729;. NET CLR 3.0.30729; Media Center PC 6.0;. net4.0c;. net4.0e; BRI/2; Tablet PC 2.0; INFOPATH.3)
content-type:application/x-www-form-urlencoded
Accept-encoding:gzip, deflate
content-length:792
Connection:keep-alive
Cache-control:no-cache
COOKIE:6E198C893C55D08419683DCDAA6E3463=07D9F9949578C1F56F881944EED7BF65; 6e198c893c55d084a63a0bba80a8bb6c0379382d298af80f= 17d870abaf8bb61086f2b509c258111a6a8d5fcab9e3cb0e69e09e1edece27cb0379382d298af80f; jsessionidmini=xdgcv7cfkqpvc2lhvxzg1ghmmbvfwnyzv7qlqgpgtsvgfljspvkl!-2010002315; jsessionidipms=qnt2v7bts1bnczd8vbxwgdx8xbgn451clkrgkhsrnfknm5p12rdq!1786716604; comtopsessionsid=<snaid>gs9yv7byzjn3tnfyhht3f8tvhj7zmzxc4ntsnc1vbtgcvdnlh9ql!64005734!1429963256371</ Snaid>

] ", which is more than the configured time (stuckthreadmaxtime) of" the "seconds. Stack Trace:
Java.util.WeakHashMap.getEntry (weakhashmap.java:383)
Java.util.WeakHashMap.containsKey (weakhashmap.java:369)
Com.bea.core.repackaged.aspectj.lang.reflect.AjTypeSystem.getAjType (ajtypesystem.java:37)
Com.bea.core.repackaged.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.isAspect ( abstractaspectjadvisorfactory.java:113)
Com.bea.core.repackaged.springframework.aop.aspectj.annotation.BeanFactoryAspectJAdvisorsBuilder.buildAspectJAdvisors (beanfactoryaspectjadvisorsbuilder.java:95)
Com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata.addAspectJAdvisors ( interceptionmetadata.java:835)
Com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata.createProxyIfNecessary ( interceptionmetadata.java:477)
Com.bea.core.repackaged.springframework.jee.intercept.InterceptionMetadata.createProxyIfNecessary ( interceptionmetadata.java:410)
Com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBrokerImpl.invokeCreateProxyIfNecessary ( EJBCOMPONENTCREATORBROKERIMPL.JAVA:97)
Com.bea.core.repackaged.springframework.jee.spi.EjbComponentCreatorBrokerImpl.getBean ( EJBCOMPONENTCREATORBROKERIMPL.JAVA:53)
Weblogic.ejb.container.injection.EjbComponentCreatorImpl.getBean (ejbcomponentcreatorimpl.java:67)
Weblogic.ejb.container.manager.BaseEJBManager.createNewBeanInstance (baseejbmanager.java:216)
Weblogic.ejb.container.manager.BaseEJBManager.allocateBean (baseejbmanager.java:233)
Weblogic.ejb.container.manager.StatelessManager.createBean (statelessmanager.java:303)
Weblogic.ejb.container.pool.StatelessSessionPool.createBean (statelesssessionpool.java:190)
Weblogic.ejb.container.pool.StatelessSessionPool.getBean (statelesssessionpool.java:121)
Weblogic.ejb.container.manager.StatelessManager.preInvoke (statelessmanager.java:148)
Weblogic.ejb.container.internal.BaseRemoteObject.preInvoke (baseremoteobject.java:227)
Weblogic.ejb.container.internal.StatelessRemoteObject.preInvoke (statelessremoteobject.java:52)
Com.gg.masterdata.objecttrack.appservice.impl.ObjectTrackSes_gtdbkl_ Iobjecttrackserviceimpl.processingtrackrecord (objecttrackses_gtdbkl_iobjecttrackserviceimpl.java:899)
Com.gg.masterdata.objecttrack.appservice.impl.ObjectTrackSes_gtdbkl_IObjectTrackServiceImpl_ Cbv.processingtrackrecord (Unknown Source)
SUN.REFLECT.NATIVEMETHODACCESSORIMPL.INVOKE0 (Native Method)


Com.bea.core.repackaged.aspectj.aspectjweaver_5.1.0.jar
Package com.bea.core.repackaged.aspectj.lang.reflect;
Import Com.bea.core.repackaged.aspectj.internal.lang.reflect.AjTypeImpl;
Import java.lang.ref.WeakReference;
Import Java.util.Map;
Import Java.util.WeakHashMap;
public class Ajtypesystem {
private static Map<class, weakreference<ajtype>> ajtypes = new Weakhashmap ();
public static <T> ajtype<t> Getajtype (class<t> fromclass) {
if (Ajtypes.containskey (Fromclass)) {
WeakReference weakreftoajtype = (weakreference) ajtypes
. get (Fromclass);
Ajtype Theajtype = (ajtype) weakreftoajtype.get ();
if (theajtype! = null) {
return theajtype;
}
Theajtype = new Ajtypeimpl (fromclass);
Ajtypes.put (Fromclass, New WeakReference (Theajtype));
return theajtype;
}

Ajtype Theajtype = new Ajtypeimpl (fromclass);
Ajtypes.put (Fromclass, New WeakReference (Theajtype));
return theajtype;
}
}


Com.bea.core.repackaged.aspectj.aspectjweaver_5.3.0.jar
Package com.bea.core.repackaged.aspectj.lang.reflect;
Import Com.bea.core.repackaged.aspectj.internal.lang.reflect.AjTypeImpl;
Import java.lang.ref.WeakReference;
Import java.util.Collections;
Import Java.util.Map;
Import Java.util.WeakHashMap;
public class Ajtypesystem {
private static Map<class, weakreference<ajtype>> Ajtypes = Collections
. Synchronizedmap (New Weakhashmap ());


public static <T> ajtype<t> Getajtype (class<t> paramclass) {
WeakReference localweakreference = (weakreference) ajtypes
. get (Paramclass);
if (localweakreference! = null) {
Localobject = (ajtype) localweakreference.get ();
if (localobject! = null)
return localobject;
Localobject = new Ajtypeimpl (paramclass);
Ajtypes.put (Paramclass, New WeakReference (Localobject));
return localobject;
}
Object localobject = new Ajtypeimpl (paramclass);
Ajtypes.put (Paramclass, New WeakReference (Localobject));
Return ((ajtype<t>) localobject);
}
}

Using HashMap thread unsafe causes CPU 100%

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.