users@grizzly.java.net

Re: Exception during FilterChain execution

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Thu, 21 May 2015 18:18:20 -0700

Hi Tiran,

while MiltiLineFilter is a good sample of how to work with Filters, it
doesn't work well when you try to write to the same Connection from
several threads at the same time.
Do you have a particular reason why you can't serialize entire message
and pass it to the next Filter, why you have to use
ctx.getInvokeAction(param)?

Thank you.

WBR,
Alexey.

On 21.05.15 11:06, Meltser Tiran wrote:
>
> Hi Alexey,
>
> I’m back on this difficult problem, hoping to crack it this time J
>
> As far as I know (to continue our conversation):
>
> 1.The only place we have in the code “ctx.getInvokeAction(state)” is
> in the MultiLinePacket class which is very similar to the one existing
> in the Grizzly examples.
>
> 2.I’ve tried to get rid of the “/GRIZZLY0013: Exception during
> FilterChain execution/
>
> */java.lang.ClassCastException:
> com.comverse.mist.app.rte.grizzly.filters.io.payload.MultiLinePacket
> cannot be cast to org.glassfish.grizzly.Appendable” /*exception by
> implementing the Appendable interface, by adding the other object’s
> lines to the current object (the one on which the append has been
> called on) lines and returning it – *not sure if this is the expected
> behavior* (there isn’t much documentation on the expected behavior,
> and especially on when is it required to be implemented)
>
> 3.The *GRIZZLY0013* errors did disappear from the logger but our
> original errors remained L
>
> 4.I suspect (no proof yet) that the problem is related to this error
> and that implementing the Appendable Interface didn’t quiet do the job
>
> 5.It seems that on such cases, the Grizzly engine doesn’t send our
> requests to the IMAP server we are working against (we are a Proxy
> between IMAP clients and an IMAP server).
>
> You have mentioned some patch that might shed some more light on the
> issue, could I trouble you with such a patch (or any other hint that
> would give us any direction, note we are running over Grizzly 2.3.20)?
>
> *Tiran Meltser***
> System Architect
> Global Products & Operations
> *Comverse* – /Making Your Network Smarter/
>
> T +972-3-7678381
> M +972-54-5639381
> Tiran.Meltser_at_comverse.com <mailto:Tiran.Meltser_at_comverse.com>
> *www.comverse.com <http://www.comverse.com/> *
>
> *P****Please think of the environment before printing this email***
>
> *From:*Meltser Tiran [mailto:Tiran.Meltser_at_comverse.com]
> *Sent:* Tuesday, February 17, 2015 2:33 PM
> *To:* users_at_grizzly.java.net
> *Subject:* RE: Exception during FilterChain execution
>
> Ok, I’ll try a few things to see if I can learn more on it, and update.
>
> *Tiran Meltser***
> System Architect
> Global Products & Operations
> *Comverse* – /Making Your Network Smarter/
>
> T +972-3-7678381
> M +972-54-5639381
> Tiran.Meltser_at_comverse.com <mailto:Tiran.Meltser_at_comverse.com>
> *www.comverse.com <http://www.comverse.com/> *
>
> *P****Please think of the environment before printing this email***
>
> *From:*Oleksiy Stashok [mailto:oleksiy.stashok_at_oracle.com]
> *Sent:* Thursday, February 12, 2015 10:40 PM
> *To:* users_at_grizzly.java.net <mailto:users_at_grizzly.java.net>
> *Subject:* Re: Exception during FilterChain execution
>
> Hi,
>
> I fear it won’t be feasible to create a working sample for you, as the
> problem happens once every 10,000 transactions and I’m quite sure it
> will not happen on a sample level complexity.
>
> Before troubling you with a patch, could you explain briefly on what
> scenarios would such an action happen?
>
> It may happen when you store a Connection related Filter state using
> either ctx.getStopAction(state) or ctx.getInvokeAction(state).
>
> In your case I'd say could be ctx.getInvokeAction(state); , because
> first of all you say you don't do that, second is
> ctx.getStopAction(state) checks if the state is Appendable and if it's
> not it will throw an Exception right away.
> So it's probably ctx.getInvokeAction(state);, or something else, which
> we'll need to investigate using patch(es).
>
> WBR,
> Alexey.
>
> *Tiran Meltser***
> System Architect
> Global Products & Operations
> *Comverse* – /Making Your Network Smarter/
>
> T +972-3-7678381
> M +972-54-5639381
> Tiran.Meltser_at_comverse.com <mailto:Tiran.Meltser_at_comverse.com>
> *www.comverse.com <http://www.comverse.com/> *
>
> *P****Please think of the environment before printing this email***
>
> *From:*Oleksiy Stashok [mailto:oleksiy.stashok_at_oracle.com]
> *Sent:* Wednesday, February 11, 2015 11:22 AM
> *To:* users_at_grizzly.java.net <mailto:users_at_grizzly.java.net>
> *Subject:* Re: Exception during FilterChain execution
>
> Hi Tiran,
>
> is it possible for you to create a testcase so I can try to reproduce
> the problem locally?
> Or I can prepare you a patch and try to find out when exactly
> MultiLinePacket gets saved to the FilterChain store.
>
> WBR,
> Alexey.
>
> On 11.02.15 01:04, Meltser Tiran wrote:
>
> Hi Alexey,
>
> I call filterChainCtx.getStopAction() [*note without arguments*]
> in 2 places:
>
> 1.In the MultiLinePacket itself, following the same logic of the
> MultiLinePacket shown in the examples; note it is used for front
> end and backend filter chains
>
> 2.Right after closing the front end client’s connection
> (connection.close()); this also causes the backend server
> connection to be closed
>
> Please note that the stack trace shows the problem happens when
> writing a request to my backend server (I’m acting as a client
> here, in general I’m a proxy so I both a server and a client at
> the same time, using Grizzly both way).
>
> Hope that sheds some light on the issue.
>
> *Tiran Meltser***
> System Architect
> Global Products & Operations
> *Comverse* – /Making Your Network Smarter/
>
> T +972-3-7678381
> M +972-54-5639381
> Tiran.Meltser_at_comverse.com <mailto:Tiran.Meltser_at_comverse.com>
> *www.comverse.com <http://www.comverse.com/> *
>
> *P****Please think of the environment before printing this email***
>
> *From:*Oleksiy Stashok [mailto:oleksiy.stashok_at_oracle.com]
> *Sent:* Wednesday, February 11, 2015 10:39 AM
> *To:* users_at_grizzly.java.net <mailto:users_at_grizzly.java.net>
> *Subject:* Re: Exception during FilterChain execution
>
> Hi Tiran,
>
> do you ever call something like
> filterChainCtx.getStopAction(multiLinePacket)?
>
> WBR,
> Alexey.
>
> On 10.02.15 22:55, Meltser Tiran wrote:
>
> Hi,
>
> When running a load test on our applications, a very small
> percentage of the requests fails with the following exception:
>
> /WARNING: GRIZZLY0013: Exception during FilterChain execution/
>
> */java.lang.ClassCastException:
> com.comverse.mist.app.rte.grizzly.filters.io.payload.MultiLinePacket
> cannot be cast to org.glassfish.grizzly.Appendable/*
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain$FilterStateElement.append(DefaultFilterChain.java:701)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain$FilterStateElement.access$600(DefaultFilterChain.java:640)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain$FiltersState.append(DefaultFilterChain.java:634)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain$FiltersState.access$200(DefaultFilterChain.java:571)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.checkStoredMessage(DefaultFilterChain.java:510)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:197)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)/
>
> / at
> org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.write(DefaultFilterChain.java:413)/
>
> / at
> org.glassfish.grizzly.nio.NIOConnection.write(NIOConnection.java:418)/
>
> / at
> org.glassfish.grizzly.nio.NIOConnection.write(NIOConnection.java:382)/
>
> / at
> com.comverse.mist.app.rte.protocol.command.AbstractProtocolCommandDispatcher.writeCommandRequestToEndPoint(AbstractProtocolCommandDispatcher.java:611)/
>
> / at
> com.comverse.mist.app.rte.protocol.command.AbstractProtocolCommandDispatcher.doDispatchCommandRequest(AbstractProtocolCommandDispatcher.java:357)/
>
> / at
> com.comverse.mist.app.rte.protocol.command.AbstractProtocolCommandDispatcher.doDispatchCommandRequest(AbstractProtocolCommandDispatcher.java:324)/
>
> / at
> com.comverse.mist.app.rte.protocol.command.AbstractProtocolCommandDispatcher.dispatchCommandRequest(AbstractProtocolCommandDispatcher.java:209)/
>
> / at
> com.comverse.mist.app.rte.protocol.command.AbstractProtocolCommandDispatcher.doDispatchCommandResponse(AbstractProtocolCommandDispatcher.java:547)/
>
> / at
> com.comverse.mist.app.rte.protocol.command.AbstractProtocolCommandDispatcher.dispatchCommandResponse(AbstractProtocolCommandDispatcher.java:369)/
>
> / at
> com.comverse.mist.app.rte.grizzly.filters.AbstractProtocolEndPointFilter.handleRead(AbstractProtocolEndPointFilter.java:184)/
>
> / at
> org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)/
>
> / at
> org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)/
>
> / at
> org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)/
>
> / at
> org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)/
>
> / at
> org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)/
>
> / at
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)/
>
> / at
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)/
>
> / at
> org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)/
>
> / at
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)/
>
> / at
> org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)/
>
> / at java.lang.Thread.run(Thread.java:745)/
>
> The object failing to be casted in our derivation of the
> MultiLinePacket (which doesn’t implement Appendable of course,
> similar to the original MultiLinePacket).
>
> *Can someone advise on why are we getting this error and what
> leads to this flow (after all, the vast majority of the flows
> pass without a problem)?*
>
> *Tiran****Meltser *
> System Architect
> Global Products & Operations
> *Comverse* – /Making Your Network Smarter/
>
> T +972-3-7678381
> M +972-54-5639381
> Tiran.Meltser_at_comverse.com <mailto:Tiran.Meltser_at_comverse.com>
> *www.comverse.com <http://www.comverse.com/> *
>
> *P **Please think of the environment before printing this email *
>
> ------------------------------------------------------------------------
>
> “This e-mail message may contain confidential, commercial or
> privileged information that constitutes proprietary
> information of Comverse Inc. or its subsidiaries. If you are
> not the intended recipient of this message, you are hereby
> notified that any review, use or distribution of this
> information is absolutely prohibited and we request that you
> delete all copies and contact us by e-mailing to:
> security_at_comverse.com <mailto:security_at_comverse.com>. Thank You.”
>
> ------------------------------------------------------------------------
>
> “This e-mail message may contain confidential, commercial or
> privileged information that constitutes proprietary information of
> Comverse Inc. or its subsidiaries. If you are not the intended
> recipient of this message, you are hereby notified that any
> review, use or distribution of this information is absolutely
> prohibited and we request that you delete all copies and contact
> us by e-mailing to: security_at_comverse.com
> <mailto:security_at_comverse.com>. Thank You.”
>
> ------------------------------------------------------------------------
>
> “This e-mail message may contain confidential, commercial or
> privileged information that constitutes proprietary information of
> Comverse Inc. or its subsidiaries. If you are not the intended
> recipient of this message, you are hereby notified that any review,
> use or distribution of this information is absolutely prohibited and
> we request that you delete all copies and contact us by e-mailing to:
> security_at_comverse.com <mailto:security_at_comverse.com>. Thank You.”
>
> ------------------------------------------------------------------------
>
> “This e-mail message may contain confidential, commercial or
> privileged information that constitutes proprietary information of
> Comverse Inc. or its subsidiaries. If you are not the intended
> recipient of this message, you are hereby notified that any review,
> use or distribution of this information is absolutely prohibited and
> we request that you delete all copies and contact us by e-mailing to:
> security_at_comverse.com <mailto:security_at_comverse.com>. Thank You.”
>
> ------------------------------------------------------------------------
> “This e-mail message may contain confidential, commercial or
> privileged information that constitutes proprietary information of
> Comverse Inc. or its subsidiaries. If you are not the intended
> recipient of this message, you are hereby notified that any review,
> use or distribution of this information is absolutely prohibited and
> we request that you delete all copies and contact us by e-mailing to:
> security_at_comverse.com. Thank You.”