glassfish
  1. glassfish
  2. GLASSFISH-17310

Remote session bean call with entity - data problem/corba stream corruption when using IP address

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 3.1.1
    • Fix Version/s: None
    • Component/s: orb
    • Labels:
      None

      Description

      When a session bean is called remotely and either its parameters or return value contain an entity bean there is a data transmission problem that seems to be caused by corba stream corruption when the InitialContext was created using an IP address.

      The problem manifests as follows:

      • If a single entity is passed in or out of the method it is received with all values set to null even though they were filled in on the sending side.
      • If a List of entities is passed in or out an exception is generated from within the corba stack indicating stream corruption. The exact exception varies depending on the makeup of the entity.

      The problem can be reproduced in two ways:

      • From a simple standalone program construct an InitialContext with a properties object where an IP address is specified for org.omg.CORBA.ORBInitialHost. Call a method on a remote session bean interface passing in a new instance of an entity bean or receiving one as a return value.
      • Deploy two ears to the same cluster. One ear should contain a session bean with remote interface and entity bean. The other ear should contain a component that calls the session bean in the first ear via an injected reference (@EJB MyTestSessionRemote foo and passes in an entity or receives one as a return value. This is the real show stopper since we do not have control over the host name used in this case so we have no way to make sure that it is not an IP address. This always fails and is preventing us from being able to migrate to glassfish 3.1.1.

      Additional notes:

      • This happens only for entities, not for other objects or lists of object. The state of the entity does not matter (new, managed, detached).
      • The problem happens only when an IPv4 IP address is used. It does not happen when a host name is used and it does not happen when an IPv6 address is used.
      • A tcpdump on the side of an external client passing in an entity through a remote interface shows that the data is being sent across the wire, so it would seem to be a problem on the deserialization side.
      • The problem happens if IP addresses are used with the "com.sun.appserv.iiop.endpoints" property as well as if an IP address is used with the "org.omg.CORBA.ORBInitialHost" property.

      Simple standalone client example that demonstrates the problem:
      public static void main(String[] args) throws NamingException {
      Properties contextEnv = new Properties();
      // contextEnv.setProperty("org.omg.CORBA.ORBInitialHost", "testhostname"); // problem does not happen
      contextEnv.setProperty("org.omg.CORBA.ORBInitialHost", "x.y.z.w"); // problem happens
      // contextEnv.setProperty("org.omg.CORBA.ORBInitialHost", "[::FFFF:x.y.z.w]"); // problem does not happen
      contextEnv.setProperty("org.omg.CORBA.ORBInitialPort", "11037");
      InitialContext ctx = new InitialContext(contextEnv);
      TestSessionRemote t = (TestSessionRemote)ctx.lookup(TestSessionRemote.class.getName());
      TestEntity e = new TestEntity(1, "test1", 1L); // int, String, Long
      t.test(e); // when the problem happens the received values are 0, null, null
      }

      Let me know if there is any more information that I can provide. This is a critical issue for us.

        Activity

        Hide
        Cheng Fang added a comment -

        assign to orb for initial evaluation.

        Are these entities serializable, or employ any custom serialization?

        Show
        Cheng Fang added a comment - assign to orb for initial evaluation. Are these entities serializable, or employ any custom serialization?
        Hide
        sarnoth added a comment -

        The entities implement Serializable and have a serialVersionUID. There is no custom serialization and all the column types are simple (int, String, Long). Below is a test entity that I used to reproduce the problem.

        @Entity
        @Table(schema = "svrmgr", name = "site_code")
        public class TestEntity implements Serializable {
            private static final long serialVersionUID = 1L;
            
            @Id
            @Column(name = "site_id", nullable = false)
            private int id;
            
            @Column(name = "site_name", nullable = false)
            private String name;
            
            @Column(name = "initial_duration_seconds", nullable = false)
            private Long value;
            
            public TestEntity() {
            }
        
            public TestEntity(int id, String name, Long value) {
                this.id = id;
                this.name = name;
                this.value = value;
            }
        
            public int getId() {
                return id;
            }
        
            public void setId(int id) {
                this.id = id;
            }
        
            public String getName() {
                return name;
            }
        
            public void setName(String name) {
                this.name = name;
            }
        
            public Long getValue() {
                return value;
            }
        
            public void setValue(Long value) {
                this.value = value;
            }
        }
        
        Show
        sarnoth added a comment - The entities implement Serializable and have a serialVersionUID. There is no custom serialization and all the column types are simple (int, String, Long). Below is a test entity that I used to reproduce the problem. @Entity @Table(schema = "svrmgr" , name = "site_code" ) public class TestEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "site_id" , nullable = false ) private int id; @Column(name = "site_name" , nullable = false ) private String name; @Column(name = "initial_duration_seconds" , nullable = false ) private Long value; public TestEntity() { } public TestEntity( int id, String name, Long value) { this .id = id; this .name = name; this .value = value; } public int getId() { return id; } public void setId( int id) { this .id = id; } public String getName() { return name; } public void setName( String name) { this .name = name; } public Long getValue() { return value; } public void setValue( Long value) { this .value = value; } }
        Hide
        Cheng Fang added a comment -

        so the key points here are IPv4 IP address and the de-serialization of entity objects. Have you tried configuring or disabling eclipselink weaving? Not sure if that's related, just some wild guess.

        Show
        Cheng Fang added a comment - so the key points here are IPv4 IP address and the de-serialization of entity objects. Have you tried configuring or disabling eclipselink weaving? Not sure if that's related, just some wild guess.
        Hide
        sarnoth added a comment -

        I tried disabling weaving and that did work around the problem.

        Show
        sarnoth added a comment - I tried disabling weaving and that did work around the problem.
        Hide
        thomas.giger added a comment -

        We see exactly the same problem (except for the fact that the hostname does not work either)
        In our environment, disabling weaving is not an option..? Are there any other work-arounds known?

        Show
        thomas.giger added a comment - We see exactly the same problem (except for the fact that the hostname does not work either) In our environment, disabling weaving is not an option..? Are there any other work-arounds known?

          People

          • Assignee:
            Harshad Vilekar
            Reporter:
            sarnoth
          • Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: