Vaadin6.2.1 and Terracotta problem

Hi

i try to run Vaadin 6.2.1 with Terracotta 3.1.1 and get a strage behavior in the uidl communication between the server and client. Sometimes the components get mixed up after some user intarcations
It looks like the new automatic component tag generator creates different tags on different machines for the same component types.

On Vaadin 6.1.2 i got these answers:
Server1:

for(;;);[{"changes":[["change",{"format": "uidl","pid": "PID_SlabelTest"},["label",{"id": "PID_SlabelTest","width": "100.0%","immediate":true},"cccc"]
]], "meta" : {}, "resources" : {}, "locales":[]}]

Server2:

for(;;);[{"changes":[["change",{"format": "uidl","pid": "PID_SlabelTest"},["label",{"id": "PID_SlabelTest","width": "100.0%","immediate":true},"cccc"]
]], "meta" : {}, "resources" : {}, "locales":[]}]

→ The component tag is
label
on both server

And with Vaadin 6.2.1 i got these answers:
Server1:

for(;;);[{"changes":[["change",{"format": "uidl","pid": "PID_SlabelTest"},["2",{"id": "PID_SlabelTest","width": "100.0%","immediate":true},"cccc"]
]], "meta" : {}, "resources" : {}, "locales":[]}]

Server2:

for(;;);[{"changes":[["change",{"format": "uidl","pid": "PID_SlabelTest"},["3",{"id": "PID_SlabelTest","width": "100.0%","immediate":true},"cccc"]
]], "meta" : {}, "resources" : {}, "locales":[]}]

→ The component tag is
2
on server1 and
3
on server2!

I think the code below is resposible for the tag creation, is that correct?

AbstractCommunicationManager.java


    private static HashMap<Class<? extends Paintable>, Integer> typeToKey = new HashMap<Class<? extends Paintable>, Integer>();
    private static int nextTypeKey = 0;

    static String getTagForType(Class<? extends Paintable> class1) {
        synchronized (typeToKey) {
            Integer object = typeToKey.get(class1);
            if (object == null) {
                object = nextTypeKey++;
                typeToKey.put(class1, object);
            }
            return object.toString();
        }
    }

any ideas to fix this problem?

Thanks
Silvan

Hi!

Can you try with latest nightly? I may have accidentally fixed the issue just few days ago related to another thing. Mappings are now not static. Consumes a bit more memory, but should be safer when session gets serialized.

Nightlies:
http://vaadin.com/download/nightly/6.2/

6.2.2 should be released soon and will contain that change.

cheers,
matti

uuhh that was a quick answer :slight_smile:

yes now the cluster works nicely with the latest 6.2 nightly

thanks a lot

I updated my incubator project SpringApplication to Terracotta 3.2 and Vaadin 6.2. I noticed that I have to add gwt-user.jar to war because of these ClientWidget annotations. For example Form have reference to VForm that have reference to gwt code. Is this a problem? Could these annotation values have String attribute instead of class attribute since I could think that this might raise some issues depending on classloader behaviour?

Hi!

gwt-user.jar should not be needed, but there may be some issues. Do you happen to use Glassfish or is this Spring specific problem? Glassfish has a nasty bug in its classloader implementation that breaks Vaadin 6.2 apps. It is already fixed, but we need to wait for new glassfish release. There is a workaround if Vaadin, but works only in basic situations.

http://dev.vaadin.com/ticket/3920

We chose class values for annotations to get better type checking and refactoring support. We’d need a lot of code for tools like Eclipse plugin if the annotation value would be String.

cheers,
matti

The problem exists when I run my demo app with Terracotta. Terracotta class instrumentation is so eager when instrumenting classes. So I guess I should blame Terracotta not Vaadin. Adding gwt-user.jar to war is not a problem since my war is really big anyway (thanks to maven2 transitive dependency control).