[ 
https://issues.apache.org/jira/browse/CAMEL-9738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Papke updated CAMEL-9738:
--------------------------------
    Description: 
The camel-mina2 consumer 
({{org.apache.camel.component.mina2.Mina2Consumer.doStart()}}) internally start 
a Mina2 IoAcceptor ({{org.apache.mina.core.service.IoAcceptor}}), but the 
{{org.apache.camel.component.mina2.Mina2Consumer.doStop()}} do not invoke 
{{acceptor.dispose(true);}} to release the threadpool started by Mina2.

*Current behavior:* While stopping the web application, the threadpool started 
by Mina2 IoAcceptor will not be stopped, so we have several thread which do not 
properly shutdown.

*Current workaround:* I create custom CamelShutdownStrategy and collect all 
Mina2Consumer and invoke Mina2consumer.getAcceptor.dispose(true); OR as an 
alternative create a dedicated consumer and overwrite the stop method of the 
Mina2 consumer as seen here: 
https://github.com/oehf/ipf/commit/12fdde8df7ebbbb7cd9966aadeab3ea3bed8fe75

*Suggested bugfix:* In 
{{org.apache.camel.component.mina2.Mina2Consumer.doShutdown()}} call the 
IoAcceptor dispose(true) method after unbind from the address.


  was:
The camel-mina2 consumer 
({{org.apache.camel.component.mina2.Mina2Consumer.doStart()}}) internally start 
a Mina2 IoAcceptor ({{org.apache.mina.core.service.IoAcceptor}}), but the 
{{org.apache.camel.component.mina2.Mina2Consumer.doStop()}} do not invoke 
{{acceptor.dispose(true);}} to release the threadpool started by Mina2.

*Current behavior:* While stopping the web application, the threadpool started 
by Mina2 IoAcceptor will not be stopped, so we have several thread which do not 
properly shutdown.

*Current workaround:* I create custom CamelShutdownStrategy and collect all 
Mina2Consumer and invoke Mina2consumer.getAcceptor.dispose(true); OR as an 
alternative create a dedicated consumer and overwrite the stop method of the 
Mina2 consumer as seen here: 
https://github.com/oehf/ipf/commit/12fdde8df7ebbbb7cd9966aadeab3ea3bed8fe75

*Suggested bugfix:* In 
{{org.apache.camel.component.mina2.Mina2Consumer.doStop()}} call the IoAcceptor 
dispose(true) method after unbind from the address.



> Thread leak for camel-mina2 consumers
> -------------------------------------
>
>                 Key: CAMEL-9738
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9738
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-mina2
>    Affects Versions: 2.16.2
>            Reporter: Thomas Papke
>         Attachments: ConsumerDispose.patch
>
>
> The camel-mina2 consumer 
> ({{org.apache.camel.component.mina2.Mina2Consumer.doStart()}}) internally 
> start a Mina2 IoAcceptor ({{org.apache.mina.core.service.IoAcceptor}}), but 
> the {{org.apache.camel.component.mina2.Mina2Consumer.doStop()}} do not invoke 
> {{acceptor.dispose(true);}} to release the threadpool started by Mina2.
> *Current behavior:* While stopping the web application, the threadpool 
> started by Mina2 IoAcceptor will not be stopped, so we have several thread 
> which do not properly shutdown.
> *Current workaround:* I create custom CamelShutdownStrategy and collect all 
> Mina2Consumer and invoke Mina2consumer.getAcceptor.dispose(true); OR as an 
> alternative create a dedicated consumer and overwrite the stop method of the 
> Mina2 consumer as seen here: 
> https://github.com/oehf/ipf/commit/12fdde8df7ebbbb7cd9966aadeab3ea3bed8fe75
> *Suggested bugfix:* In 
> {{org.apache.camel.component.mina2.Mina2Consumer.doShutdown()}} call the 
> IoAcceptor dispose(true) method after unbind from the address.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to