cpu useage 100%

Description

when is use JCaptcha in multithreading,cpu usage 100%,use jconsole,the stack :
??? http-5555-Processor387
??? RUNNABLE
?????1,564 ????? 16

?????
sun.font.GlyphLayout$LayoutEngineKey.equals(GlyphLayout.java:124)
java.util.HashMap.eq(HashMap.java:277)
java.util.HashMap.get(HashMap.java:326)
sun.font.SunLayoutEngine.getEngine(SunLayoutEngine.java:113)
sun.font.GlyphLayout$EngineRecord.init(GlyphLayout.java:565)
sun.font.GlyphLayout.nextEngineRecord(GlyphLayout.java:439)
sun.font.GlyphLayout.layout(GlyphLayout.java:362)
sun.font.ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:267)
sun.font.ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:252)
sun.font.ExtendedTextSourceLabel.createLogicalBounds(ExtendedTextSourceLabel.java:163)
sun.font.ExtendedTextSourceLabel.getAdvance(ExtendedTextSourceLabel.java:85)
java.awt.font.TextLine.init(TextLine.java:245)
java.awt.font.TextLine.<init>(TextLine.java:99)
java.awt.font.TextLine.fastCreateTextLine(TextLine.java:740)
java.awt.font.TextLayout.fastInit(TextLayout.java:695)
java.awt.font.TextLayout.<init>(TextLayout.java:611)
sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2688)
com.octo.captcha.component.image.textpaster.ChangeableAttributedString.drawString(ChangeableAttributedString.java:93)
com.octo.captcha.component.image.textpaster.DecoratedRandomTextPaster.pasteText(DecoratedRandomTextPaster.java:86)
com.octo.captcha.component.image.wordtoimage.ComposedWordToImage.pasteText(ComposedWordToImage.java:130)
com.octo.captcha.component.image.wordtoimage.AbstractWordToImage.getImage(AbstractWordToImage.java:52)
com.octo.captcha.image.gimpy.GimpyFactory.getImageCaptcha(GimpyFactory.java:77)
com.octo.captcha.engine.image.ListImageCaptchaEngine.getNextImageCaptcha(ListImageCaptchaEngine.java:574)
com.octo.captcha.engine.image.ImageCaptchaEngine.getNextCaptcha(ImageCaptchaEngine.java:92)
com.octo.captcha.service.AbstractCaptchaService.generateAndStoreCaptcha(AbstractCaptchaService.java:148)
com.octo.captcha.service.AbstractManageableCaptchaService.generateCountTimeStampAndStoreCaptcha(AbstractManageableCaptchaService.java:339)
com.octo.captcha.service.AbstractManageableCaptchaService.generateAndStoreCaptcha(AbstractManageableCaptchaService.java:328)
com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:64)
com.octo.captcha.service.image.AbstractManageableImageCaptchaService.getImageChallengeForID(AbstractManageableImageCaptchaService.java:61)
com.huawei.unms.security.web.servlet.ImageCaptchaServlet.doGet(ImageCaptchaServlet.java:82)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)

??? http-5555-Processor45
??? RUNNABLE
?????2,904 ????? 137

?????
sun.font.GlyphLayout$LayoutEngineKey.equals(GlyphLayout.java:124)
java.util.HashMap.eq(HashMap.java:277)
java.util.HashMap.get(HashMap.java:326)
sun.font.SunLayoutEngine.getEngine(SunLayoutEngine.java:113)
sun.font.GlyphLayout$EngineRecord.init(GlyphLayout.java:565)
sun.font.GlyphLayout.nextEngineRecord(GlyphLayout.java:439)
sun.font.GlyphLayout.layout(GlyphLayout.java:362)
sun.font.ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:267)
sun.font.ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:252)
sun.font.ExtendedTextSourceLabel.createLogicalBounds(ExtendedTextSourceLabel.java:163)
sun.font.ExtendedTextSourceLabel.getAdvance(ExtendedTextSourceLabel.java:85)
java.awt.font.TextLine.init(TextLine.java:245)
java.awt.font.TextLine.<init>(TextLine.java:99)
java.awt.font.TextLine.fastCreateTextLine(TextLine.java:740)
java.awt.font.TextLayout.fastInit(TextLayout.java:695)
java.awt.font.TextLayout.<init>(TextLayout.java:611)
sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2688)
com.octo.captcha.component.image.textpaster.ChangeableAttributedString.drawString(ChangeableAttributedString.java:93)
com.octo.captcha.component.image.textpaster.DecoratedRandomTextPaster.pasteText(DecoratedRandomTextPaster.java:86)
com.octo.captcha.component.image.wordtoimage.ComposedWordToImage.pasteText(ComposedWordToImage.java:130)
com.octo.captcha.component.image.wordtoimage.AbstractWordToImage.getImage(AbstractWordToImage.java:52)
com.octo.captcha.image.gimpy.GimpyFactory.getImageCaptcha(GimpyFactory.java:77)
com.octo.captcha.engine.image.ListImageCaptchaEngine.getNextImageCaptcha(ListImageCaptchaEngine.java:574)
com.octo.captcha.engine.image.ImageCaptchaEngine.getNextCaptcha(ImageCaptchaEngine.java:92)
com.octo.captcha.service.AbstractCaptchaService.generateAndStoreCaptcha(AbstractCaptchaService.java:148)
com.octo.captcha.service.AbstractManageableCaptchaService.generateCountTimeStampAndStoreCaptcha(AbstractManageableCaptchaService.java:339)
com.octo.captcha.service.AbstractManageableCaptchaService.generateAndStoreCaptcha(AbstractManageableCaptchaService.java:328)
com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:64)
com.octo.captcha.service.image.AbstractManageableImageCaptchaService.getImageChallengeForID(AbstractManageableImageCaptchaService.java:61)
com.huawei.unms.security.web.servlet.ImageCaptchaServlet.doGet(ImageCaptchaServlet.java:82)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

Environment

tomcat window 2003 spring+struts+hibernate

Activity

Show:
testhu
December 28, 2007, 1:04 PM

jdk1.5.06
spring config
<bean id="imageCaptchaService" class="com.octo.captcha.service.image.DefaultManageableImageCaptchaService">
<constructor-arg type="com.octo.captcha.service.captchastore.CaptchaStore" index="0">
<ref bean="fastHashMapCaptchaStore"/>
</constructor-arg>
<!-- (1) which captcha Engine you use -->
<constructor-arg type="com.octo.captcha.engine.CaptchaEngine" index="1">
<ref bean="captchaEngineEx"/>
</constructor-arg>
<constructor-arg index="2">
<value>180</value>
</constructor-arg>
<constructor-arg index="3">
<value>100000</value>
</constructor-arg>
<constructor-arg index="4">
<value>75000</value>
</constructor-arg>
</bean>

<bean id="fastHashMapCaptchaStore" class="com.octo.captcha.service.captchastore.FastHashMapCaptchaStore"/>

<bean id="captchaEngineEx" class="security.web.CaptchaEngineEx"/>

/**

  • <p>CaptchaEngineEx.java</p>
    */
    package security.web;

import java.awt.Color;

import com.octo.captcha.component.image.backgroundgenerator.BackgroundGenerator;
import com.octo.captcha.component.image.backgroundgenerator.GradientBackgroundGenerator;
import com.octo.captcha.component.image.color.SingleColorGenerator;
import com.octo.captcha.component.image.fontgenerator.FontGenerator;
import com.octo.captcha.component.image.fontgenerator.RandomFontGenerator;
import com.octo.captcha.component.image.textpaster.DecoratedRandomTextPaster;
import com.octo.captcha.component.image.textpaster.TextPaster;
import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage;
import com.octo.captcha.component.word.wordgenerator.RandomWordGenerator;
import com.octo.captcha.engine.image.ListImageCaptchaEngine;
import com.octo.captcha.image.gimpy.GimpyFactory;

/**

  • <p>

  • </p>

  • <p>

  • Description:

  • </p>

  • <p>

  • */
    public class CaptchaEngineEx extends ListImageCaptchaEngine {

protected void buildInitialFactories() {
/**

  • Set Captcha Word Length Limitation which should not over 6
    */
    Integer minAcceptedWordLength = new Integer(4);
    Integer maxAcceptedWordLength = new Integer(4);
    /**
    * Set up Captcha Image Size: Height and Width
    */
    Integer imageHeight = new Integer(24);
    Integer imageWidth = new Integer(60);
    /**
    * Set Captcha Font Size between 50 and 55
    */
    Integer minFontSize = new Integer(12);
    Integer maxFontSize = new Integer(13);
    /**
    * We just generate digit for captcha source char Although you can use
    * abcdefg......xyz
    */
    com.octo.captcha.component.word.wordgenerator.WordGenerator wordGenerator = (new RandomWordGenerator(
    "123456789"));
    /**
    * cyt and unruledboy proved that backgroup not a factor of Security. A
    * captcha attacker won't affaid colorful backgroud, so we just use
    * white color, like google and hotmail.
    */
    BackgroundGenerator backgroundGenerator = new GradientBackgroundGenerator(
    imageWidth, imageHeight, Color.white, Color.white);
    /**
    * font is not helpful for security but it really increase difficultness
    * for attacker
    */
    FontGenerator _fontGenerator = new RandomFontGenerator(minFontSize,
    maxFontSize);
    /**
    * Note that our captcha color is Blue
    */
    SingleColorGenerator scg = new SingleColorGenerator(Color.blue);
    /**
    * decorator is very useful pretend captcha attack. we use two line text
    * decorators.
    */
    // LineTextDecorator line_decorator = new LineTextDecorator(1, Color.blue);
    // LineTextDecorator line_decorator2 = new LineTextDecorator(1,
    // Color.blue);


/**

  • ????decorator
    */
    // TextDecorator[] textdecorators = new TextDecorator[1];
    //
    // textdecorators[0] = line_decorator;
    // textdecorators[1] = line_decorator2;

TextPaster _textPaster = new DecoratedRandomTextPaster(
minAcceptedWordLength, maxAcceptedWordLength, scg,
null);

/**

  • ok, generate the WordToImage Object for logon service to use.
    */
    com.octo.captcha.component.image.wordtoimage.WordToImage wordToImage = new ComposedWordToImage(
    _fontGenerator, backgroundGenerator, _textPaster);
    addFactory(new GimpyFactory(wordGenerator, wordToImage));
    }
    }

AntoineV
May 15, 2008, 11:52 PM
AntoineV
October 31, 2008, 8:23 PM

Is the problem still happening ?
Have you tried a limited font set ?

Cannot Reproduce

Assignee

AntoineV

Reporter

testhu

Labels

None

Affects versions

Priority

Critical
Configure