[jboss-jira] [JBoss JIRA] (WFLY-4330) Async service with EJB pool blocks threads not used

Bartosz Baranowski (JIRA) issues at jboss.org
Thu Jul 2 06:33:04 EDT 2015


    [ https://issues.jboss.org/browse/WFLY-4330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13085724#comment-13085724 ] 

Bartosz Baranowski commented on WFLY-4330:
------------------------------------------

Im inclined to close this as not a bug.

In my test: 2015-07-02T11:39:00.948/2015-07-02T11:39:02.957 ---?> Difference of hardly 9ms is not a determinant of failure( in case of 20 threads in pool ). Condition in reproducer is too strict.
Secondly, from jdoc of Thread.sleep: "Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds, subject to the precision and accuracy of system timers and schedulers. The thread does not lose ownership of any monitors."  - so if you do this, you block threads/execution. You put it on hold, but dont allow threads to be reclaimed. Thread( object/task ) is frozen in particular place in code.
Thirdly. You define bean instance pool of 5, than file 15 jobs. What happens is that there are 5 beans. First 5 jobs come in, than go to sleep for 2s, than 10 more jobs get into queue. Once first 5 is done, beans pick up 5 next jobs and freeze for 2s - 5 more await.... So what happens here, you exhaust pool( saturate it) and expect it to work like it has resources to handle all jobs, while it starves on beans.

> Async service with EJB pool blocks threads not used
> ---------------------------------------------------
>
>                 Key: WFLY-4330
>                 URL: https://issues.jboss.org/browse/WFLY-4330
>             Project: WildFly
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 8.2.0.Final
>            Reporter: Janario Oliveira
>            Assignee: Bartosz Baranowski
>         Attachments: wildfly-thread-pool.zip
>
>
> I've created a bean pool to limit the number of some instances. In that case maximum 5 instances.
> <pools>
> 	<bean-instance-pools>
> 		<strict-max-pool name="slsb-max5" max-pool-size="5" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
> 		...
> 	</bean-instance-pools>
> </pools>
> The idea was to have some async service that work simultaneous.
> @Stateless
> @Pool("slsb-max5")
> public class AsyncService {
>     @Asynchronous
>     public Future<LocalDateTime> async2Seconds() {
>         //some parallel work...
>     }
> }
> The problem is when I invoke simultaneous more than 5 times it blocks the threads even it is not using (async thread-pool-name="default", default=10)
> Attached an example project (configure slsb-max5 pool and access /test-thread-pool/rest/async-resource)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the jboss-jira mailing list