Hello!

I suggest raising these issues on developer list and/or filing tickets
against IGNITE.

Regards,
-- 
Ilya Kasnacheev


чт, 19 мар. 2020 г. в 15:43, Andrey Davydov <andrey.davy...@gmail.com>:

> I have some RnD with Apache Felix this week to found workaround for 
> multi-tenancy
> of H2.
>
>
>
> But there is problem with some Ignites in same JVM.
>
>
>
> As I see in org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing 
> latest
> started Ignite will visible via JdbcUtils.serializer, and it can be
> already closed and it workdir can be deleted.
>
>
>
> Line 2105:
>
>
>
>
>
>         if (JdbcUtils.serializer != null)
>
>             U.warn(log, "Custom H2 serialization is already configured,
> will override.");
>
>
>
>         JdbcUtils.serializer = h2Serializer();
>
>
>
> Line 2268:
>
>
>
>     private JavaObjectSerializer h2Serializer() {
>
>         return new JavaObjectSerializer() {  *//nested class has link to
> parent IgniteH2Indexing and to ingnite instance transitively*
>
>             @Override public byte[] serialize(Object obj) throws Exception
> {
>
>                 return U.marshal(marshaller, obj); *//In common case,
> binary marshaller logic depends on work dir*
>
>             }
>
>
>
>             @Override public Object deserialize(byte[] bytes) throws
> Exception {
>
>                 ClassLoader clsLdr = *ctx* != null ? U.resolveClassLoader(
> *ctx.config()*) : null; *//only configuration need, but all ctx leaked*
>
>
>
>                 return U.unmarshal(marshaller, bytes, clsLdr);
>
>             }
>
>         };
>
>     }
>
>
>
>
>
> Andrey.
>
>
>
> *От: *Ilya Kasnacheev <ilya.kasnach...@gmail.com>
> *Отправлено: *19 марта 2020 г. в 14:37
> *Кому: *user@ignite.apache.org
> *Тема: *Re: Unsafe usage of org.h2.util.JdbcUtils in Ignite
>
>
>
> Hello!
>
>
>
> As far as my understanding goes:
>
>
>
> 1) It is H2's decision to exhibit JdbcUtil.serializer as their public API,
> they have a public system property to override it:
>
>
>
>
>
>
>
>
>
>
> */** * System property <code>h2.javaObjectSerializer</code> * (default: 
> null).<br /> * The JavaObjectSerializer class name for java objects being 
> stored in * column of type OTHER. It must be the same on client and server to 
> work * correctly. */**public static final *String *JAVA_OBJECT_SERIALIZER *=
>         Utils.*getProperty*(*"h2.javaObjectSerializer"*, *null*);
>
>
>
> Obviously, this is not designed for multi-tenancy of H2 in mind.
>
>
>
> If you really need multi-tenancy, I recommend starting H2 in a separate
> class loader inherited from root class loader and isolated from any Ignite
> classes.
>
>
>
> Regards,
>
> --
>
> Ilya Kasnacheev
>
>
>
>
>
> ср, 18 мар. 2020 г. в 18:54, Andrey Davydov <andrey.davy...@gmail.com>:
>
> Hello,
>
>
>
> org.h2.util.JdbcUtils is utility class with all static methods  and
> configured via System.properties. So it system wide resource. It is
> incorrect inject Ignite specific settings in it.
>
>
>
> this     - value: org.apache.ignite.internal.IgniteKernal #1
>
> <- grid     - class: org.apache.ignite.internal.GridKernalContextImpl,
> value: org.apache.ignite.internal.IgniteKernal #1
>
>   <- ctx     - class:
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing, value:
> org.apache.ignite.internal.GridKernalContextImpl #2
>
>    <- this$0     - class:
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$10, value:
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing #2
>
>     <- serializer     - class: org.h2.util.JdbcUtils, value:
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$10 #1
>
>      <- [5395]     - class: java.lang.Object[], value:
> org.h2.util.JdbcUtils class JdbcUtils
>
>       <- elementData     - class: java.util.Vector, value:
> java.lang.Object[] #37309
>
>        <- classes     - class: sun.misc.Launcher$AppClassLoader, value:
> java.util.Vector #31
>
>         <- contextClassLoader (thread object)     - class:
> java.lang.Thread, value: sun.misc.Launcher$AppClassLoader #1
>
>
>
>    1. It cause problems, if it need to work with H2 databases from same
>    JVM where ignite run.
>    2. It cause problems, when some Ignites run in same JVM
>    3. It makes closed IgniteKernal reachable from GC root.
>
>
>
> I think it is bad architecture solution to use this class and use H2
> related system properties at all.
>
>
>
> Andrey.
>
>
>
>
>

Reply via email to