harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ray Chen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-6375) [classlib][nio]ServerSocketChannel hang when the main thread is waiting for request to accept and another thread try to configure the block mode on one channel
Date Fri, 13 Nov 2009 07:18:44 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-6375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ray Chen updated HARMONY-6375:
------------------------------

    Attachment: Harmony-6375.diff

In the ServerSocketChannelImpl.java, it holds the blockingLock, and because it is in blocking
mode, so the accept() keep waiting. But in another thread which want to change the blocking
mode, it also want to hold the blockingLock in the configureBlocking(boolean) method, which
result in a deadLock.

In the patch, I simply remove the sychronized block to resolve the thread deadlock because
the bolckingLock has been synchronized in blockingLock() method located in AbstractSelectableChannel.


This patch can make the test pass and no new test failures found in luni and nio unit tests.


I wonder, does this change hava any side effect?

If the main thread got the blocking mode and release the blockingLock, then before the main
thread do the real IO operations, another thread change the blocking mode, what behavior it
should be?

I found following description in the spec of the InterruptibleChannel interface says:
"A channel that implements this interface is asynchronously closeable: If a thread is blocked
in an I/O operation on an interruptible channel then another thread may invoke the channel's
close method. This will cause the blocked thread to receive an AsynchronousCloseException."

Any comments?

> [classlib][nio]ServerSocketChannel hang when the main thread is waiting for request to
accept and another thread try to configure the block mode on one channel
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6375
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6375
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: All platforms
>            Reporter: Ray Chen
>         Attachments: Harmony-6375.diff, Harmony6375TestCase.java
>
>
> As the summary described:
> One thread is waiting for request to accept and another thread is trying to configure
the block mode on the same channel.
> I will attach one test case file to describe the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message