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

ORB server is terminated abnormally with java.io.IOException: An existing connection was forcibly closed by the remote host

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This can be reproduce on all platforms

      Reproduce steps:'
      1. download the test.zip I attached and unzip it.
      2. cd to test
      3. set JAVAHOME to a valid jdk build.


      4. execute
      ${JAVA_HOME}/bin/idlj -fall -i/${JAVA_HOME}/include -pkgPrefix CosTransactions org.omg test.idl

      5. compile all the java files. Given test.zip is extracted to a local dir "./test"

      ${JAVA_HOME}/bin/javac --add-modules java.corba,jdk.rmic -nowarn -g -d ./workdir -classpath "./workdir" --add-exports java.corba/com.sun.corba.se.spi.activation=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.activation.LocatorPackage=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.ior=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.ior.iiop=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.impl.orbutil=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.protocol=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.impl.oa.poa=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.orb=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.transport=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.spi.legacy.connection=ALL-UNNAMED --add-exports java.corba/com.sun.corba.se.impl.legacy.connection=ALL-UNNAMED ./test/product/orbspi/customsocket/*.java

      6.mkdir repository_4050

      7. register orbd. "-d64" is only for 64 bit JVM.
      ${JAVA_HOME}/bin/java -d64 -Dsun.reflect.enableModuleChecks=debug -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -classpath "./" -XaddExports:java.corba/com.sun.corba.se.spi.activation,java.corba/com.sun.corba.se.spi.activation.LocatorPackage,java.corba/com.sun.corba.se.spi.ior,java.corba/com.sun.corba.se.spi.ior.iiop,java.corba/com.sun.corba.se.impl.orbutil,java.corba/com.sun.corba.se.spi.protocol,java.corba/com.sun.corba.se.impl.oa.poa,java.corba/com.sun.corba.se.spi.orb,java.corba/com.sun.corba.se.spi.transport,java.corba/com.sun.corba.se.spi.legacy.connection,java.corba/com.sun.corba.se.impl.legacy.connection \
      -Dcom.sun.CORBA.POA.ORBBadServerIdHandlerClass=product.orbspi.customsocket.BadServerIdHandlerImpl \
      -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=product.orbspi.customsocket.CustomSocketFactory \
      com.sun.corba.se.impl.activation.ORBD -port 4049 -defaultdb ./repository_4050 -ORBInitialPort 4050 -ORBInitialHost localhost -serverPollingTime 50 -serverStartupDelay 200 -ORBDebug orbd &

      8. start the server endpoint
      ${JAVA_HOME}/bin/java --add-modules java.corba,jdk.rmic com.sun.corba.se.impl.activation.ServerTool -ORBInitialPort 4050 -cmd \
      register -server product.orbspi.customsocket.Server \
      -applicationName customSocket \
      -classpath "./workdir" \
      -vmargs -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton \
      -DIORdir=./workdir/product/orbspi/customsocket \
      -args persistent

      9. run client. This can be ignored now since the test failed at step 8.
      ${JAVA_HOME}//bin/java -d64 -Dsun.reflect.enableModuleChecks=debug -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -classpath "./" -XaddExports:java.corba/com.sun.corba.se.spi.activation,java.corba/com.sun.corba.se.spi.activation.LocatorPackage,java.corba/com.sun.corba.se.spi.ior,java.corba/com.sun.corba.se.spi.ior.iiop,java.corba/com.sun.corba.se.impl.orbutil,java.corba/com.sun.corba.se.spi.protocol,java.corba/com.sun.corba.se.impl.oa.poa,java.corba/com.sun.corba.se.spi.orb,java.corba/com.sun.corba.se.spi.transport,java.corba/com.sun.corba.se.spi.legacy.connection,java.corba/com.sun.corba.se.impl.legacy.connection -DIORdir=./product/orbspi/customsocket \
      -DUseOnlyTaggedComponents=true \
      -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=product.orbspi.customsocket.CustomSocketFactory \
      product.orbspi.customsocket.Client persistent


      Expected: the server should run successfully at step 8. But it failed immediately with main class not found.
      ServerTableEntry constructed with activation command C:\Users\aurora\CommonData\jdk\bin\java -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket -Dioser=null -Dorg.omg.CORBA.ORBInitialPort=4050 -Dcom.sun.CORBA.activation.DbDir= -Dcom.sun.CORBA.POA.ORBActivated=true -Dcom.sun.CORBA.POA.ORBServerId=-1 -Dcom.sun.CORBA.POA.ORBServerName=product.orbspi.customsocket.Server -Dcom.sun.CORBA.activation.ORBServerVerify=true -classpath ./workdir;./workdir com.sun.corba.se.impl.activation.ServerMain persistent -debug
      Server being verified w/C:\Users\aurora\CommonData\jdk\bin\java -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket -Dioser=null -Dorg.omg.CORBA.ORBInitialPort=4050 -Dcom.sun.CORBA.activation.DbDir= -Dcom.sun.CORBA.POA.ORBActivated=true -Dcom.sun.CORBA.POA.ORBServerId=-1 -Dcom.sun.CORBA.POA.ORBServerName=product.orbspi.customsocket.Server -Dcom.sun.CORBA.activation.ORBServerVerify=true -classpath ./workdir;./workdir com.sun.corba.se.impl.activation.ServerMain persistent -debug
      ServerTableEntry: method =verify
      ServerTableEntry: server =-1
      ServerTableEntry: state =ACTIVATING
      ServerTableEntry: message =returns main class not found

      Bad server definition: main class not found.

      ================
      I suppose it is because java.corba is not in root modules of server app and com.sun.corba.se.impl.activation are not exported.

      So try with following:
      C:/Users/aurora/CommonData/jdk/bin/java --add-modules java.corba,jdk.rmic com.sun.corba.se.impl.activation.ServerTool -ORBInitialPort 4050 -cmd register -server product.orbspi.customsocket.Server -applicationName customSocket -classpath "./workdir" -vmargs --add-modules java.corba,jdk.rmic --add-exports java.corba/com.sun.corba.se.impl.activation=ALL-UNNAMED -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket -args persistent

      ServerTableEntry constructed with activation command C:\Users\aurora\CommonData\jdk\bin\java --add-modules java.corba,jdk.rmic --add-exports java.corba/com.sun.corba.se.impl.activation=ALL-UNNAMED -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket -Dioser=null -Dorg.omg.CORBA.ORBInitialPort=4050 -Dcom.sun.CORBA.activation.DbDir= -Dcom.sun.CORBA.POA.ORBActivated=true -Dcom.sun.CORBA.POA.ORBServerId=-1 -Dcom.sun.CORBA.POA.ORBServerName=product.orbspi.customsocket.Server -Dcom.sun.CORBA.activation.ORBServerVerify=true -classpath ./workdir;./workdir com.sun.corba.se.impl.activation.ServerMain persistent -debug
      Server being verified w/C:\Users\aurora\CommonData\jdk\bin\java --add-modules java.corba,jdk.rmic --add-exports java.corba/com.sun.corba.se.impl.activation=ALL-UNNAMED -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket -Dioser=null -Dorg.omg.CORBA.ORBInitialPort=4050 -Dcom.sun.CORBA.activation.DbDir= -Dcom.sun.CORBA.POA.ORBActivated=true -Dcom.sun.CORBA.POA.ORBServerId=-1 -Dcom.sun.CORBA.POA.ORBServerName=product.orbspi.customsocket.Server -Dcom.sun.CORBA.activation.ORBServerVerify=true -classpath ./workdir;./workdir com.sun.corba.se.impl.activation.ServerMain persistent -debug
      ServerTableEntry: method =verify
      ServerTableEntry: server =-1
      ServerTableEntry: state =ACTIVATING
      ServerTableEntry: message =returns Server terminated normally

      RepositoryImpl: registerServer called to register ServerDef ServerDef[applicationName=customSocket serverName=product.orbspi.customsocket.Server serverClassPath=./workdir serverArgs=persistent serverVmArgs=--add-modules java.corba,jdk.rmic --add-exports java.corba/com.sun.corba.se.impl.activation=ALL-UNNAMED -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket] with new serverId 257
      ServerManagerImpl: getEntry: no active server found.
      RepositoryImpl: getServer for serverId 257 returns ServerDef[applicationName=customSocket serverName=product.orbspi.customsocket.Server serverClassPath=./workdir serverArgs=persistent serverVmArgs=--add-modules java.corba,jdk.rmic --add-exports java.corba/com.sun.corba.se.impl.activation=ALL-UNNAMED -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket]
      ServerTableEntry constructed with activation command C:\Users\aurora\CommonData\jdk\bin\java --add-modules java.corba,jdk.rmic --add-exports java.corba/com.sun.corba.se.impl.activation=ALL-UNNAMED -Dorg.omg.CORBA.ORBInitialPort=4050 -Dorg.omg.CORBA.ORBInitialHost=localhost -Dorg.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl -Dorg.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton -DIORdir=./workdir/javahome/product/orbspi/customsocket -Dioser=null -Dorg.omg.CORBA.ORBInitialPort=4050 -Dcom.sun.CORBA.activation.DbDir=C:\Users\aurora\.\repository_4050 -Dcom.sun.CORBA.POA.ORBActivated=true -Dcom.sun.CORBA.POA.ORBServerId=257 -Dcom.sun.CORBA.POA.ORBServerName=product.orbspi.customsocket.Server -classpath ./workdir;./workdir com.sun.corba.se.impl.activation.ServerMain persistent -debug
      ServerTableEntry: method =activate
      ServerTableEntry: server =257
      ServerTableEntry: state =ACTIVATED
      ServerTableEntry: message =activating server

      ServerManagerImpl: locateServer called with serverId=257 endpointType=IIOP_CLEAR_TEXT block=false
      ServerManagerImpl: activate for server Id 257 found location null and activated it
      ServerManagerImpl: getEntry: active server found ServerTableEntry[state=ACTIVATED serverId=257 activateRetryCount=0].
      ServerManagerImpl: active for server Id 257 called. This server is now active.
      ServerTableEntry: method =register
      ServerTableEntry: server =257
      ServerTableEntry: state =ACTIVATED
      ServerTableEntry: message =process registered back

      ServerManagerImpl: registerEndpoints for server Id 257 called. This server is now active.
      registering type: IIOP_CLEAR_TEXT port 51110
      ServerTableEntry: method =registerPorts
      ServerTableEntry: server =257
      ServerTableEntry: state =RUNNING
      ServerTableEntry: message =process registered Ports

      lookup num-ports 1 IIOP_CLEAR_TEXT 51110
      ServerTableEntry: method =deActivate
      ServerTableEntry: server =257
      ServerTableEntry: state =DE_ACTIVATED
      ServerTableEntry: message =server deactivated

      org.omg.CORBA.COMM_FAILURE: ----------BEGIN server-side stack trace----------
      org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe
              at java.corba@9-ea/com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(ORBUtilSystemException.java:2400)
              at java.corba@9-ea/com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(ORBUtilSystemException.java:2418)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBits(SocketOrChannelConnectionImpl.java:375)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.handleEvent(SocketOrChannelConnectionImpl.java:1148)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.SelectorImpl.run(SelectorImpl.java:324)
      Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 211 completed: No
              at java.corba@9-ea/com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(ORBUtilSystemException.java:2484)
              at java.corba@9-ea/com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenReadingConnection(ORBUtilSystemException.java:2502)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHeader(MessageBase.java:134)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.CorbaContactInfoBase.createMessageMediator(CorbaContactInfoBase.java:168)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBits(SocketOrChannelConnectionImpl.java:333)
              ... 2 more
      Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
              at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
              at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
              at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
              at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:192)
              at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:382)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFully(SocketOrChannelConnectionImpl.java:620)
              at java.corba@9-ea/com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:542)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHeader(MessageBase.java:130)
              ... 4 more

      ----------END server-side stack trace---------- vmcid: SUN minor code: 208 completed: Maybe
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:461)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:921)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:116)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:590)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:489)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:373)
              at java.corba@9-ea/com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:148)
              at java.corba@9-ea/org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:475)
              at java.corba@9-ea/com.sun.corba.se.spi.activation._ActivatorStub.install(_ActivatorStub.java:152)
              at java.corba@9-ea/com.sun.corba.se.impl.activation.RegisterServer.processCommand(ServerTool.java:333)
              at java.corba@9-ea/com.sun.corba.se.impl.activation.ServerTool.executeCommand(ServerTool.java:209)
              at java.corba@9-ea/com.sun.corba.se.impl.activation.ServerTool.run(ServerTool.java:95)
              at java.corba@9-ea/com.sun.corba.se.impl.activation.ServerTool.main(ServerTool.java:122)


      ==============================================
      This was a success history output on Windows:
      ServerTableEntry: method =activate
      ServerTableEntry: server =257
      ServerTableEntry: state =ACTIVATED
      ServerTableEntry: message =activating server

      ServerManagerImpl: locateServer called with serverId=257 endpointType=IIOP_CLEAR_TEXT block=false
      ServerManagerImpl: activate for server Id 257 found location null and activated it
      ServerManagerImpl: getEntry: active server found ServerTableEntry[state=ACTIVATED serverId=257 activateRetryCount=0].
      ServerManagerImpl: active for server Id 257 called. This server is now active.
      ServerTableEntry: method =register
      ServerTableEntry: server =257
      ServerTableEntry: state =ACTIVATED
      ServerTableEntry: message =process registered back

      ServerManagerImpl: registerEndpoints for server Id 257 called. This server is now active.
      registering type: IIOP_CLEAR_TEXT port 64921
      ServerTableEntry: method =registerPorts
      ServerTableEntry: server =257
      ServerTableEntry: state =RUNNING
      ServerTableEntry: message =process registered Ports

      lookup num-ports 1 IIOP_CLEAR_TEXT 64921

      Then at step 9, client/server communicates successfully. Please refer to the sample output:
      Initialized the ORB
      Read the IOR from the file
      Invoking echo() operation...
      CLIENT: received msg. from Server: Hello Client
      CLIENT: received msg. from Server: Hello Client
      CLIENT: received msg. from Server: Hello Client

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            xiaofeya Xiaofeng Yang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: