You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/03/26 13:01:00 UTC

[jira] [Commented] (GEODE-6559) PdxInstance.getObject() is using class from older jar in case of Reconnect

    [ https://issues.apache.org/jira/browse/GEODE-6559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16801660#comment-16801660 ] 

ASF subversion and git services commented on GEODE-6559:
--------------------------------------------------------

Commit 17a949b9379a680af066b0a249ad475014f86331 in geode's branch refs/heads/develop from Jens Deppe
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=17a949b ]

GEODE-6559: PdxInstance.getObject() is using class from older jar in case of Reconnect (#3353)

- TypeRegistry needs to be cleared during reconnect
- Fix ServerStarterRule to not blindly disable some PDX attributes on server start
- Currently configuring PDX, via gfsh, does not work correctly in
  conjunction with this rule.

Authored-by: Jens Deppe <jd...@pivotal.io>


> PdxInstance.getObject() is using class from older jar  in case of Reconnect
> ---------------------------------------------------------------------------
>
>                 Key: GEODE-6559
>                 URL: https://issues.apache.org/jira/browse/GEODE-6559
>             Project: Geode
>          Issue Type: Bug
>          Components: configuration, management, serialization
>            Reporter: Jens Deppe
>            Assignee: Jens Deppe
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Given a function as below:
> {code:java}
> public void execute(FunctionContext context) {
>         RegionFunctionContext rctx = (RegionFunctionContext)context;
>         Region<Object, Object> dataSet = rctx.getDataSet();
>         Object o = ((PdxInstance)context.getArguments()).getObject();
>         LogService.getLogger().warn(o.getClass() + " loaded from " + getClassLoaderJar(o.getClass()));
>         printCallerStack("Function execution called from");
>         LogService.getLogger().warn("Thread context classloader is " + Thread.currentThread().getContextClassLoader());
>         LogService.getLogger().error(this);
>         LogService.getLogger().warn(Student.class + " loaded from " + getClassLoaderJar(Student.class));
>         LogService.getLogger().warn(o.getClass() + " args class parent is " + o.getClass().getClassLoader().getParent());
>         LogService.getLogger().warn(o.getClass() + " loaded from " + getClassLoaderJar(o.getClass()));
>         LogService.getLogger().warn(this.getClass() + " loaded from " + getClassLoaderJar(this.getClass()));
>         Student args = (Student) o;
>         LogService.getLogger().warn("args = " + args);
>         Integer first = 1;
>         Integer second = 2;
>         LogService.getLogger().info("Function returning result " + this.getClass() + " loaded from " + this.getClass().getClassLoader());
>         rctx.getResultSender().lastResult(first * second);
>     }
> {code}
> It works fine in case of normal operations and jar --deploy , but in case of auto-reconnect, the below line
> {code}
>  Object o = ((PdxInstance)context.getArguments()).getObject();
> {code}
> Loads the class from older jar
> {code}
> [warning 2019/03/14 14:23:43.420 IST server2 <Function Execution Processor1> tid=0x11f] class com.pivotal.support.hot.deploy.Student loaded from [file:/Users/rajiv/kumar/gemfire/deployJarTest/server2/deploy.v1.jar]
> {code}
> Mostly due to the caching in the InternalDeserializer.
> Whereas the below
> {code}
>         Student args = (Student) o;
> {code}
> Loads the class from the latest jar, for each reconnect attempt the jar is downloaded from the locators and the version is increased
> {code}
> [warning 2019/03/14 14:23:43.426 IST server2 <Function Execution Processor1> tid=0x11f] class com.pivotal.support.hot.deploy.Student loaded from [file:/Users/rajiv/kumar/gemfire/deployJarTest/server2/deploy.v3.jar]
> {code}
> This is causing ClassCastExcetpion
> {code}
> [warning 2019/03/14 14:23:43.426 IST server2 <Function Execution Processor1> tid=0x11f] Exception on server while executing function : com.pivotal.support.hot.deploy.Multiply@3e484c00
> java.lang.ClassCastException: com.pivotal.support.hot.deploy.Student cannot be cast to com.pivotal.support.hot.deploy.Student
>         at com.pivotal.support.hot.deploy.Multiply.execute(Multiply.java:43)
>         at org.apache.geode.internal.cache.execute.AbstractExecution.executeFunctionLocally(AbstractExecution.java:332)
>         at org.apache.geode.internal.cache.execute.AbstractExecution$1.run(AbstractExecution.java:274)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>         at org.apache.geode.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:665)
>         at org.apache.geode.distributed.internal.DistributionManager$9$1.run(DistributionManager.java:1111)
>         at java.lang.Thread.run(Thread.java:745)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)