AWS Simple Workflow (SWF): stuck at DecisionTaskStarted (No Activities found for the given execution.)

Problem

AWS Simple Workflow (SWF): stuck at DecisionTaskStarted (No Activities found for the given execution.)

Cause / Solution

MyService.process() returns right away; so if your program terminates afterwards, it may also terminate all of the other services that are running; causing the java.net.SocketException

Adding following fixes the problem (if you processing takes long; you may need to sleep longer)

Thread.sleep(30 * 1000);

 

Details

In my case I was launching all of the activity and workflow workers from JUnit.  So when MyService.process() returned (which was right away); the program would terminate; terminating all of my activities and decision/workflow workers/services.

What made it difficult to debug/catch was that I had log messages in the Activities which never appeared; so I was thinking that for some reason the activities were not being launched; understandable they just didn’t have enough time to startup (since test was being terminated almost right away).

p.s. Other reasons why this might occur are described in this AWS-SWF thread.

Exception

com.amazonaws.http.AmazonHttpClient  - Unable to execute HTTP request: Socket closed

 

3605 [SWF Activity Poll user-execution-engine-tasklist 1] INFO  com.amazonaws.http.AmazonHttpClient  - Unable to execute HTTP request: Socket closed
java.net.SocketException: Socket closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:152)
	at java.net.SocketInputStream.read(SocketInputStream.java:122)
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:312)
	at sun.security.ssl.InputRecord.read(InputRecord.java:350)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
	at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:884)
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
	at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
	at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
	at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
	at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:713)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
	at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:315)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:199)
	at com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient.invoke(AmazonSimpleWorkflowClient.java:3017)
	at com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient.pollForActivityTask(AmazonSimpleWorkflowClient.java:1760)
	at com.amazonaws.services.simpleworkflow.flow.worker.SynchronousActivityTaskPoller.poll(SynchronousActivityTaskPoller.java:158)
	at com.amazonaws.services.simpleworkflow.flow.worker.ActivityTaskPoller.pollAndProcessSingleTask(ActivityTaskPoller.java:81)
	at com.amazonaws.services.simpleworkflow.flow.worker.GenericWorker$PollServiceTask.run(GenericWorker.java:94)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
3605 [SWF Decider aiconductor-workflow-tasklist 1] INFO  com.amazonaws.http.AmazonHttpClient  - Unable to execute HTTP request: Socket closed
java.net.SocketException: Socket closed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:152)
	at java.net.SocketInputStream.read(SocketInputStream.java:122)
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:312)
	at sun.security.ssl.InputRecord.read(InputRecord.java:350)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
	at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:884)
	at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
	at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
	at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
	at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
	at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
	at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
	at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
	at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:713)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
	at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:315)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:199)
	at com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient.invoke(AmazonSimpleWorkflowClient.java:3017)
	at com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient.pollForDecisionTask(AmazonSimpleWorkflowClient.java:2520)
	at com.amazonaws.services.simpleworkflow.flow.worker.DecisionTaskPoller.poll(DecisionTaskPoller.java:171)
	at com.amazonaws.services.simpleworkflow.flow.worker.DecisionTaskPoller.access$000(DecisionTaskPoller.java:31)
	at com.amazonaws.services.simpleworkflow.flow.worker.DecisionTaskPoller$DecisionTaskIterator.<init>(DecisionTaskPoller.java:44)
	at com.amazonaws.services.simpleworkflow.flow.worker.DecisionTaskPoller.pollAndProcessSingleTask(DecisionTaskPoller.java:197)
	at com.amazonaws.services.simpleworkflow.flow.worker.GenericWorker$PollServiceTask.run(GenericWorker.java:94)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
3610 [SWF Activity Poll user-execution-engine-tasklist 1] DEBUG com.amazonaws.http.AmazonHttpClient  - Retrying on java.net.SocketException: Socket closed
3615 [SWF Decider aiconductor-workflow-tasklist 1] DEBUG com.amazonaws.http.AmazonHttpClient  - Retrying on java.net.SocketException: Socket closed
3616 [SWF Decider aiconductor-workflow-tasklist 1] DEBUG com.amazonaws.auth.AWS3Signer  - Calculated StringToSign: POST

 

keywords:

stuck hanging spring inject asynchronous

 

search bread crumbs:

Searched for com.amazonaws.http.AmazonHttpClient – Unable to execute HTTP request: Socket closed 10:43am
AWS Developer Forums: WARN: Unable to… – amazon.com – Viewed 2 times 10:43am
The Leaky Connection Pool – Krishna Pai – krishnapai.me
Searched for aws DecisionTaskStarted 6:30pm
https://forums.aws.amazon.com/tags/decisionta… 6:30pm
https://forums.aws.amazon.com/tags/decisionta… 6:30pm
http://docs.aws.amazon.com/AWSJavaSDK/latest/… 6:30pm

 

 

 

 

 

 

 

 

 

 

About Neil Rubens

see http://ActiveIntelligence.org

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*