Hi,

I'm using Johnzon in TomEE 8.0.0-M2. In some rest calls, I do my own
marshalling from a string to an Object. Intermittently (maybe 50% of the
times I bounce TomEE), after TomEE starts and I send rest requests to the
server, threads lock up and I get timeouts. It appears as though the
threads never free up and get stuck in one of two states:

"TomEE-Exec-1" #228 daemon prio=5 os_prio=0 tid=0x00007fddb0b22800
nid=0x1e4 in Object.wait() [0x00007fddac4df000]
   java.lang.Thread.State: RUNNABLE
at
org.apache.johnzon.core.JsonArrayBuilderImpl.build(JsonArrayBuilderImpl.java:319)
at org.apache.johnzon.core.JsonReaderImpl.readValue(JsonReaderImpl.java:100)
at
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:125)
at org.apache.johnzon.mapper.Mapper.mapObject(Mapper.java:254)
at org.apache.johnzon.mapper.Mapper.readCollection(Mapper.java:202)
at org.apache.johnzon.jsonb.JohnzonJsonb.fromJson(JohnzonJsonb.java:190)
at guru.jini.arch.impl.json.JsonImpl.toList(JsonImpl.java:129)

OR

"TomEE-Exec-6" #237 daemon prio=5 os_prio=0 tid=0x00007fddb008d000
nid=0x224 in Object.wait() [0x00007fddb4bce000]
   java.lang.Thread.State: RUNNABLE
at
org.apache.johnzon.core.JsonObjectBuilderImpl.add(JsonObjectBuilderImpl.java:122)
at
org.apache.johnzon.core.JsonReaderImpl.parseObject(JsonReaderImpl.java:221)
at org.apache.johnzon.core.JsonReaderImpl.readValue(JsonReaderImpl.java:83)
at
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:125)
at org.apache.johnzon.mapper.Mapper.mapObject(Mapper.java:254)
at org.apache.johnzon.mapper.Mapper.readObject(Mapper.java:189)
at org.apache.johnzon.mapper.Mapper.readObject(Mapper.java:184)
at org.apache.johnzon.jsonb.JohnzonJsonb.fromJson(JohnzonJsonb.java:58)
at guru.jini.arch.impl.json.JsonImpl.toObject(JsonImpl.java:124)

The more requests I send the more threads end up in one of these 2 states.
This happens irrespective of the string I am marshalling to an object and
irrespective of the class I am trying to marshal to.
The threads are not in a loop as the CPU remains low and if I run jstack
over and over these threads remain in the same state.
See how the threads are RUNNABLE and yet are in Object.wait(). I cannot
understand what is going on as both those lines of code seem innocent
enough so what are they waiting for???

I can then bounce the JVM and it can work flawlessly and then bounce it
again and the issue can happen. Its as though there is a race condition in
the boot process that puts things into a weird state.

in guru.jini.arch.impl.json.JsonImpl I create the jsonb as follows. I've
tried sharing a single instance as well as creating a new one on each call
- with no change in results:

JsonbConfig config = new JsonbConfig()
                .withPropertyVisibilityStrategy(new
PropertyVisibilityStrategy() {
                    @Override
                    public boolean isVisible(Field field) {
                        return Modifier.isPublic(field.getModifiers())
                                ||
Modifier.isProtected(field.getModifiers());
                    }

                    @Override
                    public boolean isVisible(Method method) {
                        return Modifier.isPublic(method.getModifiers());
                    }
                })
                .withAdapters(new ZonedDateTimeAdapter());
        jsonb = JsonbBuilder.newBuilder().withConfig(config).build();



Paul Carter-Brown
Director
Jini Guru
m: +27 (0) 83 442 7179 <+27834427179>
a: 1st Floor, Golf House, Design Quarter, Cnr. William Nicol and Leslie
  Johannesburg, South Africa
w: jini.guru  e: p...@jini.guru

Disclaimer: This message and/or attachment(s) may contain
privileged, confidential and/or personal information. If you are not the
intended recipient you may not disclose or distribute any of
the information contained within this message. In such case you must
destroy this message and inform the sender of the error. Jini Guru may not
accept liability for any errors, omissions, information and viruses
contained in the transmission of this message. Any opinions, conclusions
and other information contained within this message not related to Jini
Guru official business is deemed to be that of the individual only and is
not endorsed by Jini Guru.

Reply via email to