Bug 1030936 - JBAS014249 if a fire and forget asynchronous ejb call is made
JBAS014249 if a fire and forget asynchronous ejb call is made
Status: VERIFIED
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: EJB (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity unspecified
: DR3
: EAP 6.4.0
Assigned To: Dominik Pospisil
Jan Martiska
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-15 06:16 EST by wfink
Modified: 2017-10-09 20:24 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
reproducer (5.94 MB, application/zip)
2014-09-22 05:28 EDT, Jan Martiska
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-2515 Major Resolved JBAS014249 if a fire and forget asynchronous ejb call is made 2017-03-24 06:01 EDT

  None (edit)
Description wfink 2013-11-15 06:16:59 EST
If an ejb method
@Asynchronous void fireAndForget(...)
is called remote and the client disconnect an Exception JBAS014249 will be thrown if the async method return.

11:02:27,544 INFO  [org.jboss.as.quickstarts.ejb.asynchronous.AsynchronousAccessBean] (EJB default - 1) action 'fireAndForget' finished
11:02:27,547 ERROR [org.jboss.as.ejb3] (EJB default - 1) JBAS014249: Error invoking method public abstract void org.jboss.as.quickstarts.ejb.asynchronous.AsynchronousAccess.fireAndForget(long) on bean named AsynchronousAccessBean for appname  modulename jboss-ejb-asynchronous-ejb distinctname : java.lang.NullPointerException
	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:322)
	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$100(MethodInvocationMessageHandler.java:70)
	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:203)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_25]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
	at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final-redhat-1.jar:2.1.1.Final-redhat-1]

11:02:27,552 ERROR [org.jboss.as.ejb3] (EJB default - 1) JBAS014250: Could not write method invocation failure for method public abstract void org.jboss.as.quickstarts.ejb.asynchronous.AsynchronousAccess.fireAndForget(long) on bean named AsynchronousAccessBean for appname  modulename jboss-ejb-asynchronous-ejb distinctname  due to: java.io.IOException: JBAS014560: Could not open message outputstream for writing to Channel
	at org.jboss.as.ejb3.remote.protocol.AbstractMessageHandler.writeException(AbstractMessageHandler.java:102)
	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$400(MethodInvocationMessageHandler.java:70)
	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:213)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_25]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
	at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final-redhat-1.jar:2.1.1.Final-redhat-1]
Caused by: org.jboss.remoting3.NotOpenException: Writes closed
	at org.jboss.remoting3.remote.RemoteConnectionChannel.openOutboundMessage(RemoteConnectionChannel.java:108) [jboss-remoting-3.2.16.GA-redhat-1.jar:3.2.16.GA-redhat-1]
	at org.jboss.remoting3.remote.RemoteConnectionChannel.writeMessage(RemoteConnectionChannel.java:297) [jboss-remoting-3.2.16.GA-redhat-1.jar:3.2.16.GA-redhat-1]
	at org.jboss.as.ejb3.remote.protocol.versionone.ChannelAssociation.acquireChannelMessageOutputStream(ChannelAssociation.java:68)
	at org.jboss.as.ejb3.remote.protocol.AbstractMessageHandler.writeException(AbstractMessageHandler.java:100)
	... 9 more
Comment 1 Jan Martiska 2014-07-02 06:52:48 EDT
This worked in EAP 6.0 but it doesn't in 6.1/6.2/6.3.. It's a regression but probably not really a blocker, as it doesn't seem to affect applications, just  logs. Proposing for 6.4.
Comment 2 Kabir Khan 2014-09-15 12:05:41 EDT
https://github.com/jbossas/jboss-eap/pull/1681
Comment 3 Jan Martiska 2014-09-17 10:03:31 EDT
The fix doesn't seem to resolve the issue to me, I am still getting the exact same exception.

The JBAS014249 message is (I think, at least in my case) logged here:
https://github.com/jbossas/jboss-eap/blob/EAP_6.4.0.DR1-dev-2/ejb3/src/main/java/org/jboss/as/ejb3/remote/protocol/versionone/MethodInvocationMessageHandler.java#L220

so checking for isAsyncVoid only at 
https://github.com/jbossas/jboss-eap/blob/EAP_6.4.0.DR1-dev-2/ejb3/src/main/java/org/jboss/as/ejb3/remote/protocol/versionone/MethodInvocationMessageHandler.java#L249

isn't enough.
Comment 4 Dominik Pospisil 2014-09-22 04:39:14 EDT
Jan, could you please provide more info what is your use case and exact stack trace? If your exception has been thrown at line 220, my understanding is that it happened during method invocation so logging it in such case shoud be fine.
Comment 5 Dominik Pospisil 2014-09-22 04:51:44 EDT
What I wanted to say is that we are definitely not trying to avoid logging such exception alltogether.
Comment 6 Jan Martiska 2014-09-22 05:28:00 EDT
Created attachment 939935 [details]
reproducer
Comment 7 Jan Martiska 2014-09-22 05:28:47 EDT
(In reply to Dominik Pospisil from comment #4)
> Jan, could you please provide more info what is your use case and exact
> stack trace? If your exception has been thrown at line 220, my understanding
> is that it happened during method invocation so logging it in such case
> shoud be fine.

That's exactly how I understand this issue - the client disconnects WHILE the invocation is still running. My scenario is:
- The client invokes an async void method
- The async method starts a 5 seconds wait
- The client disconnects before the method finishes

This scenario used to work correctly on EAP 6.0 (without exceptions in server log).

If I understand correctly, your scenario expects that the client disconnects while the server is trying to write out the invocation result, which is a really short timespan - quite unlikely to hit.

My stacktrace is completely the same as in the bug description:
	at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:203)
----> this element shows that it occurs during result = invokeMethod(...)

Attached a reproducer with my scenario.
Comment 8 Dominik Pospisil 2014-09-23 11:31:33 EDT
Thanks. This is in fact manifestation of yet another issue - invocation of void async method never finishes successfully. The invokeMethod(...) should finish normally even if the client disconects.

PR sent: https://github.com/jbossas/jboss-eap/pull/1707
Comment 9 Kabir Khan 2014-09-26 08:03:43 EDT
https://github.com/jbossas/jboss-eap/pull/1707
Comment 10 Jan Martiska 2014-10-01 04:49:53 EDT
Works fine in EAP 6.4.0.DR3, thanks.

Note You need to log in before you can comment on or make changes to this bug.