You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Paul Carter-Brown <pa...@jini.guru> on 2019/03/27 18:51:59 UTC

Re: Johnzon Threads Locking up marshalling from String to Object

Did anything come of this issue? There seem to be a lot of undeterministic
behaviour in the jsonb initialization. Sometimes custom adapters are
ignored. Sometimes it locks up etc.

On Tue, 26 Feb 2019, 13:56 Paul Carter-Brown, <pa...@jini.guru>
wrote:

> Yes!!! This seems to be the exact issue. I have worked around it by
> getting jsonb to do a simple string to object mapping as soon as I've
> configured it in my provider. Only then do I allow multiple threads to use
> it.
>
> On Tue, 26 Feb 2019, 13:26 Jonathan Gallimore, <
> jonathan.gallimore@gmail.com> wrote:
>
>> Hi Paul
>>
>> Does this (from the Johnzon mailing list yesterday):
>> http://mail-archives.apache.org/mod_mbox/johnzon-dev/201902.mbox/browser
>> sound similar to  your issue?
>>
>> Regards
>>
>> Jon
>>
>> On Tue, Feb 26, 2019 at 12:29 AM Jonathan Gallimore <
>> jonathan.gallimore@gmail.com> wrote:
>>
>> > I'd be pretty surprised if the ear vs war deployment made a difference,
>> > but you never know... feel free to send your working war sample over, it
>> > might just help us bootstrap something. It would be useful to get the
>> full
>> > guru.jini.arch.impl.json.JsonImpl.toObject and
>> > guru.jini.arch.impl.json.JsonImpl.toList methods. Or the whole
>> > guru.jini.arch.impl.json.JsonImpl class, if you're able to share it. We
>> can
>> > help set up something to hammer that code.
>> >
>> > Also, can we get the rest of the stack below
>> > guru.jini.arch.impl.json.JsonImpl.toList/toObject?
>> >
>> > Thanks
>> >
>> > Jon
>> >
>> > On Mon, Feb 25, 2019 at 11:59 PM Paul Carter-Brown
>> > <pa...@jini.guru> wrote:
>> >
>> >> Hi Daniel,
>> >>
>> >> For the life of me I cannot recreate the issue in a simple project
>> with a
>> >> WAR. My project is an EAR with multiple WARS. I will continue trying
>> but
>> >> in
>> >> the meantime wondered if anyone has any clues where to look?
>> >>
>> >> 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: paul@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.
>> >>
>> >>
>> >>
>> >> On Mon, Feb 25, 2019 at 7:41 PM Daniel Cunha <da...@apache.org>
>> >> wrote:
>> >>
>> >> > Hi Paul,
>> >> >
>> >> > could you share a sample project with your issue?
>> >> > It will help to reproduce and analyze your case.
>> >> >
>> >> > Thank you.
>> >> >
>> >> > Em seg, 25 de fev de 2019 às 14:35, Paul Carter-Brown
>> >> > <pa...@jini.guru> escreveu:
>> >> >
>> >> > > 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: paul@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.
>> >> > >
>> >> >
>> >> >
>> >> > --
>> >> > Daniel "soro" Cunha
>> >> > https://twitter.com/dvlc_
>> >> >
>> >>
>> >
>>
>