db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6455) Infinite loop in NetworkServerControlImpl.ensureDataInBuffer
Date Wed, 22 Jan 2014 13:11:20 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13878622#comment-13878622
] 

ASF subversion and git services commented on DERBY-6455:
--------------------------------------------------------

Commit 1560341 from [~knutanders] in branch 'code/branches/10.10'
[ https://svn.apache.org/r1560341 ]

DERBY-6455: Infinite loop in NetworkServerControlImpl.ensureDataInBuffer

Merged revision 1559946 from trunk.

> Infinite loop in NetworkServerControlImpl.ensureDataInBuffer
> ------------------------------------------------------------
>
>                 Key: DERBY-6455
>                 URL: https://issues.apache.org/jira/browse/DERBY-6455
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Server
>    Affects Versions: 10.10.1.1
>            Reporter: Martin JANDA
>            Priority: Critical
>             Fix For: 10.10.1.4, 10.11.0.0
>
>         Attachments: d6455-1a.diff
>
>
> NetworkServerControlImpl.ensureDataInBuffer missing check for return -1 (EOF) from 'clientIs.read'.
When read returns -1 thread consumes 100% CPU. Method NetworkServerControlImpl.fillReplyBuffer
correctly throw exception.
> Fix: add two lines:
>     private void ensureDataInBuffer(int minimumBytesNeeded) throws Exception
>     {
>         // make sure the buffer is large enough
>         while ((replyBufferCount - replyBufferPos) < minimumBytesNeeded)
>         {
>             try {
>                 int bytesRead = clientIs.read(replyBuffer, replyBufferCount, replyBuffer.length
- replyBufferCount);
> +                if (bytesRead == -1)
> +                    consolePropertyMessage("DRDA_InvalidReplyTooShort.S", true);
>                 replyBufferCount += bytesRead;
>         
>             } catch (IOException e)
>             {
>                 clientSocketError(e);
>             }
>         }
>     }
> StackTrace:
>   java.lang.Thread.State: RUNNABLE
>           at java.net.SocketInputStream.read(Unknown Source:-1)
>           at org.apache.derby.impl.drda.NetworkServerControlImpl.ensureDataInBuffer(Unknown
Source:-1)
>           at org.apache.derby.impl.drda.NetworkServerControlImpl.readLDString(Unknown
Source:-1)
>           at org.apache.derby.impl.drda.NetworkServerControlImpl.readStringReply(Unknown
Source:-1)
>           at org.apache.derby.impl.drda.NetworkServerControlImpl.runtimeInfo(Unknown
Source:-1)
>           at org.apache.derby.drda.NetworkServerControl.getRuntimeInfo(Unknown Source:-1)
>           at com.crcdata.dbadmin.server.DerbyEngine.getRuntimeInfo(DerbyEngine.java:134)
>           at com.crcdata.dbadmin.server.DerbyEngine$DerbyServerMonitorTask.run(DerbyEngine.java:305)
>           at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source:-1)
>           at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source:-1)
>           at java.util.concurrent.FutureTask.run(Unknown Source:-1)
>           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source:-1)
>           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source:-1)
>           at java.lang.Thread.run(Unknown Source:-1)



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message