Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4887178

in with J2se1.3 in multithread situation, socket reads data unexpectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.1_11
    • 1.3.1
    • core-libs
    • None
    • 11
    • sparc
    • solaris_8
    • Verified

        escalationID is 547065
        My ISV experiences the below problem as below

        testcase is in SocketBug.jar
        start server from ost.ServerSimulator
        start client from ost.ClientSimuator

        BUG : in multithreads situation, socket improperly reads data instead of
        blocking read or throw exceptions, although lock is designed properly.
         
        Platform: J2SE1.3
                                 
        Senario:
        The bug is reproducible only with the setSOtimeout ,without an setSOtimeout
        there is no problem


        First ServerSimulator Threads generate many sockets in server side, pass those
        sockets to SocketReader Threads and put SocketReaders to a thread pool for
        reading
        also pass those sockets to SocketCloser threads groups for closing sockets by
        putting socketcloser threads into a same threadpool and ServerSimuator Threads
        group will also setSoTimeout for every
        passed socket , SocketReader thread read data from inputstream completely, it
        will notfiy SocketCloser thread to close this socket, then it trys to read 4
        bytes data again . at this moment
        it should block at p = in.read(data, 0, 4), because client doesnot send data
        again.
        At this moment, socket could be closed or still open, if socket is closed by
        SocketCloser , then IOException should happen at p=in.read(data,0,4). if
        blocking time expired, then also IOException will
        happen at p=in.read(data,0,4), but SocketReader should never be able to read any
        data at in.read(data,0,0,4), but in multi threads situation, it does read data
        unexpectedly.

              poonam Poonam Bajaj Parhar
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: